-
What do you want to achieve? Keep it simple and clear!
I’m making LocalPlayer script that turns a player’s saved checkpoints green when a they join the game. -
What is the issue? Include screenshots / videos if possible!
In the leaderstats, it is shown that the checkpoint value of a player is 10, for example. But in the Output it is only printed out as 0.
This is the script:
local CheckPoints = game.Workspace:WaitForChild("CheckPoints")
local Plr = game.Players.LocalPlayer
local leaderstats = Plr:WaitForChild("leaderstats")
local checkpoint = leaderstats:WaitForChild("Checkpoint",10)
local function SavedCheckPointsColor()
print("GRN")
for _,thing in CheckPoints:GetChildren() do
--check if thing is a checkpoint
local areaNum = tonumber(string.match(thing.Name, "[0-9]+$"))
if thing.Name:find("CheckPoint") and areaNum and areaNum > 0 then
if areaNum <= checkpoint.Value then
print(tostring(thing))
if thing:FindFirstChild("Point") then
local Point = thing:FindFirstChild("Point")
print(Point.Parent)
----point GREEN
Point.BrickColor = BrickColor.new("Lime green")
else
warn("no POINT?")
end
else
print(areaNum..">"..checkpoint.Value)
end
end
end
end
while not game:IsLoaded() do
task.wait()
end
SavedCheckPointsColor()