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

Lighting to Backpack script; help?

Asked by
painzx3 43
10 years ago

How do I make a script so that if a model is clicked, the same version of it that has been already put in "Lighting" is cloned into the player's backpack? So far I have this...

Weapon = Lighting.Musket
script.Parent.MouseClick:connect(function(ClickedPlayer)
    Weapon:clone().Parent = Player.Backpack
end)
script.Parent.MouseClick:connect

--You'd put this under ClickDetector.

1 answer

Log in to vote
0
Answered by
wrenzh 65
10 years ago

I'm not entirely certain, but I do not believe you can use Lighting to reference the service unless you've defined it as a variable, so make it Weapon = game.Lighting.Musket unless you have a variable set for Lighting.

Also, where it says Weapon:clone().Parent = Player.Backpack, there is a problem: you used ClickedPlayer as the parameter to MouseClick, but then you called Player. Change that to ClickedPlayer.

This is all I could find; I hope this works for you!

EDIT: If you have any other questions, check out the MouseClick page on the Wiki : http://wiki.roblox.com/index.php?title=MouseClick_(Event)

Ad

Answer this question