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)
The problem is you have no touch "Debounce" in your portal. So it looks like it's firing each time a part of the player like arms, legs, accessories etc... touch the portal part.
To fix that, change this:
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)
To this:
StarterPack script: ~~~~~~~~~~~~~~~~~ local touchName = "Stages" local rs = game:GetService("ReplicatedStorage") local touchEvent = rs:WaitForChild('TouchEvent') local portal = workspace.FirstStage.FrostPartal.PortalPart --// debounce code! Variable declare local Debounce = false portal.Touched:Connect(function() if(Debounce == false) then --// check for our debounce is false or accepting Debounce = true --// set it to true for this part touchEvent:FireServer() --// call the server script wait(1) --// wait 1 second to stop repeated touches, change this to your liking but not too small otherwise it will bug out again!. Debounce = false --// free up our debounce variable for next run end end)
Hope this helps! :)