If I understand correctly, you’re trying to get the player instance from the string value? If that’s the case you can do what you said which is check when they join or touch an object. But if you don’t want to do either of those can you tell me where the things.stringValue object is located?
I’m trying to change the Leaderstats named “Status” everytime the StringValue is equal to “Stop”
I’ll try to explain better:
You join the server and your Leaderstats Status is “Not Qualified” so you start play and win the match, when you win your status become “Qualified” and you can go through another level but during the level there is a timer, i’m using a StringValue for the timer so i can use multiple word + numbers without change and create a mess (for example you will see “Stopping in 10, 9…” and so on until “Stop”) So at the end of the timer i want to change the leaderstats of every player checking them and changing them for example
if Player.LeaderStats.Status.Value == "Qualified" then
print("Good")
Player.LeaderStats.Status.Value = "Not Qualified" --to start another match
--other things..
end
I only don’t know how to get the player and make it work for everyone
If needed i’ll add a gameplay video of the game so will be easier i guess
i also tried to use
game.players.localplayer and so on but didn’t work
game:GetService("Players").LocalPlayer can only be used on client side scripts (localscripts). If you’re writing the if statement inside of the PlayerAdded function then Player is already there. Mind showing us the full code?
Ok so, i’m using those scripts for now, i know i can do better but is still WIP
Timer script
wait(5)
n = 0
text = script.Parent
repeat
n = n+1
text.Value = ("Waiting for other players.")
wait(1)
text.Value = ("Waiting for other players..")
wait(1)
text.Value = ("Waiting for other players...")
wait(1)
until n == 10
while true do
Timer = 20
text = script.Parent
wait(10)
local player = game.Players:GetPlayers()
for i = 1, #player do
player[i].Character:MoveTo(Vector3.new(195, 2, 1))
player[i].Team = game.Teams.Playing
end
text.Value = ("Starting in 10..")
wait(1)
text.Value = ("Starting in 9..")
wait(1)
text.Value = ("Starting in 8..")
wait(1)
text.Value = ("Starting in 7..")
wait(1)
text.Value = ("Starting in 6..")
wait(1)
text.Value = ("Starting in 5..")
wait(1)
text.Value = ("Starting in 4..")
wait(1)
text.Value = ("Starting in 3..")
wait(1)
text.Value = ("Starting in 2..")
wait(1)
text.Value = ("Starting in 1..")
wait(1)
text.Value = ("GO!")
wait(.1)
workspace.Wall.CanCollide = false
repeat
Timer = Timer -1
text.Value = ("Stopping in " .. Timer .. " Seconds.")
wait(1)
until Timer == 0
text.Value = ("STOP!") --this is the stop value that starts everything
workspace.Wall.CanCollide = true
local player = game.Players:GetPlayers()
for i = 1, #player do
player[i].Character:MoveTo(Vector3.new(195, 2, 1))
player[i].Team = game.Teams["Waiting/Spectating"]
end
wait(5)
text.Value = ("Next round will start soon...")
end
LeaderStats Creator
local function onPlayerJoin(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
-- Example of a IntValue
local points = Instance.new("IntValue")
points.Name = "Money"
points.Value = 0
points.Parent = leaderstats
local Status = Instance.new("StringValue")
Status.Name = "Status"
Status.Value = "Not Qualified"
Status.Parent = leaderstats
end
game.Players.PlayerAdded:Connect(onPlayerJoin)
Point Giver
debounce = false
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if not debounce then
debounce = true
player.Character.HumanoidRootPart.CFrame = game.Workspace.StartPlate.CFrame + Vector3.new(0,10,0)
player.leaderstats.Status.Value = "Qualified"
player.leaderstats.Money.Value = player.leaderstats.Money.Value + 10
player.team = game.Teams["Waiting/Spectating"]
wait(3)
debounce = false
end
end
end)
I just need to emulate the Point Giver to change the Status LeaderStats without using a touch part