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

How Can i Target in Players LocalPlayer?? and not like Example Player1

function Clicked()
game.Players.Player1.leaderstats.Faction.Value = game.Players.Player1.leaderstats.Faction.Value + 1
end

script.Parent.MouseButton1Down:connect(Clicked)

So its only work with Player1 but i need to change it to LocalPlayer so its Can Give him 1 Point Sorry for me Bad English aim Dutch ;)

1 comment

0

Is it on a LocalScript or a Server Script?

2 answers

It is on a LocalScript and to find the player, you just do: player = game.Players.LocalPlayer

Well, you just need to find your leaderstats inside of the local player

function Clicked()
game.Players.LocalPlayer.leaderstats.Faction.Value = game.Players.LocalPlayer.leaderstats.Faction.Value + 1
end

script.Parent.MouseButton1Down:connect(Clicked)

then add the value.

You can also do that way

local player = game.Players.LocalPlayer
local leaderstats = player:WaitForChild("leaderstats")
local Faction = leaderstats:WaitForChild("Faction")

function Clicked()
Faction.Value = 
Faction.Value + 1
end

script.Parent.MouseButton1Down:connect(Clicked)

I dont know if the second one is working cause i didnt tested, but should work

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