How do I change the value of this marked variable from a script inside serverscriptserveice?
1 Like
You can just get the player object, then find the value and change it.
local player: Player = --insert player object
local folder = player:FindFirstChild("Expp")
local value = folder:FindFirstChild("Exp")
if value then
value.Value = -- insert change
end
1 Like
If you’re asking about how to get the player from serversided script - its quite simple
game.Players.PlayerAdded:Connect(function(player) -- Here you got the player
-- and now you can change it like --
player.Expp.Exp.Value = --value--
end)
1 Like
Adding to @CodeSaviour’s Script. Might not be perfect:
game.Players.PlayerAdded:Connect(function(player)
if player.Name == "Aktron_Gaming" then
player.Expp.Exp.Value = 0
end
end)
1 Like
If you want to change it for specific player only, then correct.
1 Like
I want to achieve something like this, but it is not working.
If you want it for any player, use this Script:
game.Players.PlayerAdded:Connect(function(player)
while task.wait(5) do
player.Expp.Exp.Value += 0
end
end)
However, if you want it for a specific player like yourself, use this:
game.Players.PlayerAdded:Connect(function(player)
while task.wait(5) do
if player.Name == "Aktron_Gaming" then --add more players by using 'or'
player.Expp.Exp.Value += 0
end
end
end)
I would also add task.wait()
instead of just wait()
.
1 Like
game.Players.PlayerAdded:Connect(function(player)
while wait(5) do
player.Expp.Exp.Value += 50
end
end)
1 Like
Thank you, this one is what I was looking for.