I have this localscript inside a sword, and there's a part that's not working. The output gives no error message at all. Please help. The specific part that has a problem is supposed to make a gui that is in the sword be cloned to the player that activated it.
local Tool = script.Parent;
enabled = true
function onButton1Down(mouse)
if not enabled then
return
end
enabled = false
mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
wait(.5)
mouse.Icon = "rbxasset://textures\\GunCursor.png"
enabled = true
end
function onEquippedLocal(mouse)
if mouse == nil then
print("Mouse not found")
return
end
--This part is the problem
player = game.Players.LocalPlayer
if script.Parent.Parent.Ability1name ~= "Swords" and script.Parent.Parent.Ability2name ~= "Swords" and script.Parent.Parent.Ability3name ~= "Swords" and player.PlayerGui:FindFirstChild("Train") == false then
script.Parent.Train:Clone().Parent = player.PlayerGui
end
mouse.Icon = "rbxasset://textures\\GunCursor.png"
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end
Tool.Equipped:connect(onEquippedLocal)

2 comments
Thanks so much!
Welcome