#localplayer for a server script???

5 messages · Page 1 of 1 (latest)

scarlet fulcrum
#

so i have a fully working script, however it only works for one person, whose username has to be put in:

        newCube.Touched:Connect(function(touched)
            local humanoid = touched.Parent:FindFirstChild("Humanoid")
                if humanoid then
            game.Players.Averpyxl.leaderstats.money.Value = game.Players.Averpyxl.leaderstats.money.Value + value
            newCube:Destroy()
        end
    end)```
this is the code, i dont know how to make it for all players in the server, i currently just used my username for it and it works but if anyone knows how i can fix it, please help me.
shell hound
#

use game.Players:GetPlayerFromCharacter(touched.Parent) to get the player that touched the part

scarlet fulcrum
#

could i use lua local plr = game.Players:GetPlayerFromCharacter(touched.Parent)

#

and use that instead of the player username

shell hound
#

yeah