I have a script for a sword that I am making. When I click play, the game is stopped and I am given the message, "Character is not a valid member of workspace." Please help me fix the problem and understand what I should do. Here is my script: (the 5th line is highlighted in red.)
local sword = script.Parent local handle = sword:WaitForChild("Handle") local event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent") local player = sword.Parent.Parent local character = player.Character or player.CharacterAdded:wait()
It is because you have the tool in Workspace so once the game load sword.Parent.Parent is Worskpace.So charater is not a property of workspace
What I suggest you do is disable the script by clicking the disabled property or add this code.
This must be under sword variable.
sword.Disabled = true
What you then can do is you give someone the tool you set Disabled back false . What disable does it won't run the code inside the script.