I made script what counts on what stage you are. So i scripted when you touching portal leaderstats value needs to be 1, it gives me around 25 stages?
Leaderstats script :
local function onPlayerJoin(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player
local money = Instance.new("IntValue")
money.Name = "Stages"
money.Value = 0
money.Parent = leaderstats
end
game.Players.PlayerAdded:Connect(onPlayerJoin)
local touchName = "Stages" local rs = game:GetService("ReplicatedStorage")
local touchEvent = rs:WaitForChild('TouchEvent')
touchEvent.OnServerEvent:Connect(function(plr)
plr.leaderstats[touchName].Value = plr.leaderstats[touchName].Value +1
wait(1)
end)
StarterPack script:
local touchName = "Stages"
local rs = game:GetService("ReplicatedStorage")
local touchEvent = rs:WaitForChild('TouchEvent')
local portal = workspace.FirstStage.FrostPartal.PortalPart
portal.Touched:Connect(function()
touchEvent:FireServer()
end)

1 comment
Thanks so much! I have one question, how to make script work once for one player? Because i have button "Back To Start"