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

How di i assign the localplayer in this script?

Asked by 6 years ago
humanoid.HealthChanged:connect(function()
    local players = game:GetService("Players")


end)

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

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) User#20388 0 — 6y
0
Can u give an example? kattenverzorger 23 — 6y
0
katt, is this a localscript or a script Elixcore 1337 — 6y
0
Elixcore -- > probably a script because you cannot change health with a local one (you can but it won't replicate) User#20388 0 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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
Ad

Answer this question