Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Help with this?

Weapon = game.Workspace.Lighting.Musket
script.Parent.MouseClick:connect(function(PlayerClicked)
    Weapon:clone().Parent = Player.Backpack
script.Parent.
end <==
end 
script.Parent.MouseClick:connect



--Currently under ClickDetector (should I ungroup it w/ the ClickDetector or keep it with it?

This script is currently in a "prop" weapon that was placed so that when a player clicked it, the tool itself would be cloned into the person's backpack. Tell me where the error is but in studio in the "end" where the arrow is pointing, it says '' expected near 'end'.... So this means?

3 answers

Weapon = game.Workspace.Lighting.Musket -- assuming "Lighting" is a member of Workspace and you aren't trying to get the Lighting service.
script.Parent.MouseClick:connect(function(PlayerClicked)
    Weapon:clone().Parent = PlayerClicked.Backpack
--script.Parent.  Why was this part in there? This is the error.
end) -- <==



--Currently under ClickDetector (should I ungroup it w/ the ClickDetector or keep it with it?

Errors: Lighting may be used incorrectly.

It should be PlayedClicked instead of Player

The random script.Parent.

1 extra end

the event end should be closed with a parenthesis.

3 comments

0

The second "end" is showing an error. It says " ')' expected (to close'('at line 2) near 'end'"

0

I fixed that with the edit. The current code should be correct.

0

Thank you very much!

Error: Line 1

Lighting is not a child of Workspace. It's a child of game just like Workspace.

Weapon = game.Lighting.Musket

1 comment

0

I assumed Lighting was a model inside Workspace. If it is, the problem would be with the random "script.Parent." But if he was in fact trying to get the Lighting Service then yes, this is correct.

You had two many ends, and you never closed your :connect(). That's why you got the problem.

Weapon = game.Workspace.Lighting.Musket

script.Parent.MouseClick:connect(function(Player)
	x =  Weapon:clone()
	x.Parent = Player.Backpack
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.