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

Help with this?

Asked by
painzx3 43
10 years ago
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 '<name>' expected near 'end'.... So this means?

3 answers

Log in to vote
0
Answered by
jav2612 180
10 years ago
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.

0
The second "end" is showing an error. It says " ')' expected (to close'('at line 2) near 'end'" painzx3 43 — 10y
0
I fixed that with the edit. The current code should be correct. jav2612 180 — 10y
0
Thank you very much! painzx3 43 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

Error: Line 1

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

Weapon = game.Lighting.Musket
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. jav2612 180 — 10y
Log in to vote
0
Answered by 10 years ago

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)

Answer this question