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

Tool script not working?

Asked by 9 years ago

I'm making a strategy game and you find a gun in one part, once you click it, you get it. But It won't work.

script.Parent.ClickDetector.MouseClick:connect(function()
    game.Lighting.Pistol:Clone().Parent = Backpack
    script.Parent:Destroy()
end)

Thank you for the help!

1 answer

Log in to vote
1
Answered by
DevWork 80
9 years ago

This script is meant to be a child of the ClickDetector.

Pistol = game.Lighting.Pistol

script.Parent.MouseClick:connect(function(player)
    if player.Backpack:FindFirstChild("Pistol") == nil then
    x = Pistol:Clone()
    x.Parent = player.Backpack
    script.Parent.Parent:Destroy()
    end
end)

Hope this is what your looking for.

0
It works, nice. Grenaderade 525 — 9y
0
Welcome. DevWork 80 — 9y
Ad

Answer this question