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

Gui tool giver Help?

Asked by 9 years ago

it does not work can someone help me?

function onClicked()
    pistol = game.Lighting["Cheezburger"]:clone()
            pistol.Parent = player.Backpack
end


script.Parent.MouseButton1Click:connect(onClicked)

1 answer

Log in to vote
0
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
9 years ago

You never defined player. I also advise against storing objects in Lighting; the object should go in ReplicatedStorage since the client is accessing it.

local player=game.Players.LocalPlayer
local pistol=game.ReplicatedStorage.Cheezburger

script.Parent.MouseButton1Click:connect(function()
    pistol:Clone().Parent=player.Backpack
end)
Ad

Answer this question