I just edited my reply, so it is more clear what to do.
Ok thanks, I’ll try that! I tell you the results in a few minutes!
ok, I know how to fix this too.
just give me a moment to do it
Thank you very much! Have a good day!
The multiple tools thing is happening because there is no cooldown, and when you touch the part you are actually touching it multiple times as you are moving, and you have many parts in the character.
do this instead:
script.Parent.Touched:Connect(function(part) -- check if the part has been touched, then run the function. The part is the part that touched this part
cooldown = false
if part.Parent:FindFirstChild("Humanoid") and cooldown == false then -- check if the part has a sibling called "Humanoid" humanoid is only in characters and we are checking if cooldown is done.
local tool = game.Workspace.GloveNameHere:Clone() --change "Workspace" to wherever your tool is and continue going down the children if it is in another thing, and change "Tool" to the name of your tool. This is cloning the tool
tool.Parent = part.Parent -- put the tool in the players character, this makes it start equiped.
cooldown = true
wait(1)
cooldown = false
end
end)
this will also add a cooldown for one second, so all the players do not flood the code. which can cause lag if your game is already laggy.
Did this script work? I would like to know so that if it does not I can try to find a way that will work.
I’ll tell you when I’ll be back of school! I don’t tried it for the moment.
I really am sorry, here, I edited the code I hope it works now:
script.Parent.Touched:Connect(function(part) -- check if the part has been touched, then run the function. The part is the part that touched this part
cooldown = false
if part.Parent:FindFirstChild("Humanoid") then -- check if the part has a sibling called "Humanoid" humanoid is only in characters
if cooldown == false then
local tool = game.Workspace.GloveNameHere:Clone() --change "Workspace" to wherever your tool is and continue going down the children if it is in another thing, and change "Tool" to the name of your tool. This is cloning the tool
tool.Parent = part.Parent -- put the tool in the players character, this makes it start equiped.
cooldown = true
wait(1)
cooldown = false
end
end
end)
Also, If there are errors from the output please let me know what they are.
Don’t be sorry you already helped a lot!
Still don’t work…
That means it wants you to change it to local.
local cooldown =
don’t do
cooldown =
exactly
(extra characters, ignore this)
Begin logging the entire script line by line so like after the first line write
print(“Event called”)
and do this for every line (with different text) and share the output.
I totally forgot about these, the print checkpoints will help a lot