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

How di i assign the localplayer in this script?

humanoid.HealthChanged:connect(function()
	local players = game:GetService("Players")

	
end)

I want to assign a variable to the player who makes it lose health.

4 comments

0

LocalPlayer is client only, change your question, also it's way harder than were you're thinking of, I normally use 'tags' wich I give to the player when a player damages him with the damager his name on it (stringvalue)

0

Can u give an example?

0

katt, is this a localscript or a script

0

Elixcore -- > probably a script because you cannot change health with a local one (you can but it won't replicate)

1 answer

Step 1: is your code in a localscript? if not, you cannot. Step 2: fixing,

if you are using a normal script, dont use local player:

game.Players[humanoid.Parent.Name]

if you are using a localscript:

game.Players.LocalPlayer

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