Subtitles section Play video
This video will show you
這個視頻將告訴你
how to make a sword on Roblox.
如何在Roblox上製作一把劍。
Insert parts using the part button
使用零件按鈕插入零件
and design your sword to your liking.
並根據你的喜好設計你的劍。
We're going to design a simple sword
我們要設計一把簡單的劍
using parts and wedge parts.
使用部件和楔形部件。
Once you've finished creating your sword,
一旦你完成了創建你的劍。
insert a part and name it Handle.
插入一個部件並命名為 "處理"。
Make sure it has a capital H
確保它有一個大寫的H
and scale the part down to be small.
並將該部分的規模縮小到很小。
Move your handle to where you want the player
將你的手柄移動到你想要的位置
to hold your sword.
來握住你的劍。
Now select all of your parts
現在選擇你的所有部件
and ensure that the anchored property is set to unchecked.
並確保錨定屬性被設置為未勾選。
Click on the plus icon in the workspace
點擊工作區的加號圖標
and insert a tool object.
並插入一個工具對象。
Select your parts and drag them into the tool.
選擇你的零件並將它們拖入工具中。
Again, make sure that the handle part
同樣,要確保手柄部分
is spelled correctly and has a capital H,
拼寫正確,並且有一個大寫的H。
otherwise the tool will not work.
否則,該工具將無法工作。
Now we need to weld all of the parts together
現在我們需要將所有的部件焊接在一起
so that the sword doesn't fall apart.
這樣,劍就不會散架。
Click the plus icon on the handle
點擊手柄上的加號圖標
and insert a WeldConstraint.
並插入一個WeldConstraint。
Set the Part0 property to the handle
將Part0屬性設置為句柄
and set the Part1 property to one of the other parts.
並將Part1屬性設置為其他部分中的一個。
Repeat this step until you've set up WeldConstraints
重複這一步,直到你設置好WeldConstraints為止。
which connect the handle to every other part.
它將手柄與其他各部分連接起來。
Make sure Part0 is the handle on every weld.
確保Part0是每條焊縫的手柄。
Now ensure that your sword is the correct size
現在確保你的劍是正確的尺寸
relative to a Roblox character.
相對於一個Roblox角色。
You can do this by inserting an NPC character
你可以通過插入一個NPC角色來做到這一點
via the plugins, rig builder menu,
通過插件,裝備製造者菜單。
or by inserting an NPC from the toolbox.
或通過從工具箱中插入一個NPC。
Change the size of your sword
改變你的劍的大小
by selecting the tool object,
通過選擇工具對象。
then by selecting the scale tool.
然後通過選擇縮放工具。
Name your sword by selecting the tool
通過選擇工具為你的劍命名
and changing the name property in the properties panel.
並在屬性面板中改變名稱屬性。
Drag the sword into the starter pack
將劍拖入啟動包
and then click the play button.
然後點擊播放按鈕。
Select your sword in the toolbar to equip it.
在工具欄中選擇你的劍來裝備它。
If your sword is not rotated correctly,
如果你的劍沒有正確旋轉。
close the test session, select the handle again,
關閉測試會話,再次選擇手柄。
and then press control + R, or command + R on Mac,
然後按control + R,或者Mac上的command + R。
to rotate by 90 degrees.
來旋轉90度。
Now that we've created our sword,
現在我們已經創建了我們的劍。
we can script it to kill other players.
我們可以用腳本來殺死其他玩家。
Insert a script into the tool.
在工具中插入一個腳本。
Inside this script, we are writing code to kill the player.
在這個腳本中,我們正在編寫代碼來殺死玩家。
We detect when the sword touches another object,
我們檢測的是,當劍接觸到另一個物體時。
check to make sure it's a player or NPC,
檢查以確保它是一個玩家或NPC。
and if so, we deduct health from their humanoid,
如果是,我們就從他們的人形中扣除健康。
which will kill them.
這將殺死他們。
We also add their character
我們還增加了他們的性格
to a debounce table for two seconds
到去勢表兩秒的時間
to ensure that there's a cooldown for the script.
以確保該腳本有一個冷卻時間。
You can find this code
你可以找到這個代碼
by going to the link in the description.
通過進入描述中的鏈接。
Select a part and duplicate it.
選擇一個部件並複製它。
Then use the scale tool
然後使用比例工具
to make it cover the area of the sword which we don't hold.
以使其覆蓋我們不持有的劍的區域。
This will be the part which detects touches
這將是檢測觸摸的部分。
from players that the sword hits.
從被劍擊中的玩家那裡。
Set the transparency of the hitbox to 1,
將打擊箱的透明度設置為1。
and then duplicate a WeldConstraint in the handle
然後在手柄中複製一個WeldConstraint。
and set the Part1 to the hitbox.
並將Part1設置為打擊箱。
You can test your sword by inserting an NPC into the game
你可以通過在遊戲中插入一個NPC來測試你的劍
via the toolbox or rig builder.
通過工具箱或鑽機建造者。
Then walk up to the NPC and touch the sword against it.
然後走到NPC面前,用劍碰它。
The NPC should be killed.
該NPC應該被殺死。
Now you can go back to select your handle
現在你可以回去選擇你的手柄
and set its transparency to 1.
並將其透明度設置為1。