"current parent is NULL, new parent is PLAYER NAME" how do i fix this??
- what the code is supposed to do - equip and unequip sword
- what the code is actually doing - its equipping unequipping only one time but then it isnt working
- the code itself- local script that fires the event to say the server script make sword equip unequip
local UIS = game:GetService("UserInputService")
local Bool = game.ReplicatedStorage:WaitForChild("Equipped")
Bool = false
local equipped = false
UIS.InputBegan:Connect(function(input)
01 | if input.KeyCode = = Enum.KeyCode.E then |
04 | if equipped = = false then |
06 | game.ReplicatedStorage.SwordEquipped:FireServer() |
10 | game.ReplicatedStorage.SwordUnEquipped:FireServer() |
end)
server script -
local Bool = game.ReplicatedStorage:WaitForChild("Equipped")
local sword = game.ServerStorage.Sword:Clone()
1 | game.Players.PlayerAdded:Connect( function (player) |
2 | player.CharacterAdded:Connect( function (character) |
game.ReplicatedStorage.SwordEquipped.OnServerEvent:Connect(function()
1 | sword.Parent = character |
2 | local handle = sword:WaitForChild( "WeldPart" ) |
5 | local Weld = Instance.new( "Weld" , sword) |
8 | Weld.Part 1 = character [ "Right Arm" ] |
game.ReplicatedStorage.SwordUnEquipped.OnServerEvent:Connect(function()
end)
- errors/warnings/prints in the output-
The Parent property of Sword is locked, current parent: NULL, new parent YellowFirecantdielol"