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

Why doesn't this script work?

script.Parent.MouseClick:connect(function() game.Players.LocalPlayer.Character.Humanoid.Health = 0 end)

It's in a clickdector, its a script so if you click the brick, they die but wont work in-game, only works in studio

4 comments

0

Is this in a LocalScript?

0

No

0

I'll try, again too put in local script

0

Local script failed

1 answer

✓ Accepted answer

Alright, your problem is that you can't access LocalPlayer from a normal Script in a live Server.

Luckily, ClickDetectors' MouseClick returns an argument that is the Player who clicked, allowing you to do this:

script.Parent.MouseClick:connect(function(plyr)
	plyr.Character.Humanoid.Health = 0
end)

2 comments

0

DUDE

0

THANX AT ADARK

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