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

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

Asked by 7 years ago
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 ;)

0
Is it on a LocalScript or a Server Script? iDarkGames 483 — 7y

2 answers

Log in to vote
0
Answered by
ekweji 4
7 years ago

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

Ad
Log in to vote
0
Answered by 7 years ago

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

Answer this question