Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why won't my SwordGiver brick work?

Asked by
Flylux 0
10 years ago

I put this script (Below) into a part called: SwordGiver

function OnTouched(Part) h = Part.Parent:FindFirstChild("Humanoid") if h~= nil then Sword = game.ServerStorage.LinkedSword:Clone() Sword.Parent = game.Players:FindFirstChild(Part.Parent.name).Backpack

end

end

script.Parent.Touched:connect(OnTouched) ~~~~~~~~~~~~~~~~~

The LinkedSword is in the ServerStorage I Test Solo, and when my player walks across it, nothing happens, help?

0
Why did that script mess up? Flylux 0 — 10y
0
Idk... trogyssy 221 — 10y
0
3rd line. Look at the "name" it should be "Name" ConnorVIII 448 — 10y

1 answer

Log in to vote
0
Answered by
trogyssy 221 Moderation Voter
10 years ago
local db=false--Here's a debounce
script.Parent.Touched:connect(function(Part)
if not db then
db=true
h = Part.Parent:FindFirstChild("Humanoid") 
if h then 
Sword = Game.ServerStorage.LinkedSword:Clone() 
Sword.Parent = game.Players:FindFirstChild(Part.Parent.Name).Backpack --You need to capitalize "Name"...
end
db=false
end
end
) 
Ad

Answer this question