Thanks for such a detailed response i got it working. Thank You
Ok so i found this…sometimes i would spawn at the start even after being at checkpoint 4 (not supposed to happen) and also the leaderstats wouldn’t always show up im not sure why, but if i rejoin it appears again!?
Edit i have added 30 checkpoints so maybe that broke something i dont know
Use teams instead and make sure that “Neutral” is false and “AllowTeamChangeOnTouch” is enabled.
Then, when the player touches the spawnlocation, they are automatically teamed to the team colour that they touched and when they die they re-spawn back at the last spawnlocation the player touched.
robloxapp-20200814-0854485.wmv (5.4 MB)
Quality is not the best…
hello, ah as i said in a previous reply
So adding teams would be a mess to the side
You don’t have to have the teams showing on the side. If you watch my video you can see that there are no teams showing on the playerlist.
Is there a way to hide them? if there is i will consider them.
They are already hidden, watch the video.
i have watched it, did you hide it or was it already hidden?
Teams are automatically hidden unless you insert a team module into the teams folder.
I have not included any team modules just spawn locations.
ok ill see how it goes
30charssss
Ah i forgot to mention why i didn’t want teams i also want leaderstats showing what level you are up to, can you add them to the teams?
I dont understand what you mean. Are you wanting players to be able to see what level other players are?
Yes
30charssssssssssssssssssssssssss
If you want other players to see what part of the obby players are on then you could just add team modules and number them in sync with the spawn locations, this will then however show up on the player list which you don’t want it to do so.
im using the script @Zombiefin suggested, which is this:
script.Parent.Touched:Connect(function(hit)
local hum = hit.Parent:FindFirstChild(“Humanoid”)
if hum then
local player = game.Players:FindFirstChild(hum.Parent.Name)
if player then
local stats = player:FindFirstChild("leaderstats")
if stats then
local checkp = stats:FindFirstChild("Checkpoint")
if checkp then
if checkp.Value == (script.Parent.Name - 1) then
checkp.Value = checkp.Value + 1
end
end
end
end
end
end)
do you know how to add a [ if leaderstats “checkpoints” = 1 set spawn at checkpoint 1 ] line to this?
Yes i have
30charsssssssssssss
This should be working then, have you checked the output?
Checkpoint.rbxl (24.7 KB)
I was messing around with checkpoints, take a look, this might help with what you are trying to do
AdminScript (For Testing, /sl username level)
ServerScriptService>AdminScript
local Admins = {""}
local Module = require(game.ServerScriptService.CheckpointModule)
game.Players.PlayerAdded:Connect(function(Player)
if table.find(Admins, Player.Name) then
Player.Chatted:Connect(function(msg)
if msg:lower():sub(1,9) == "/setlevel" or msg:lower():sub(1,3) == "/sl" then
local TargetName = string.split(msg, " ")[2]
local TargetLevel = string.split(msg, " ")[3]
for i,v in pairs(game.Players:GetPlayers()) do
if v.Name:lower() == TargetName:lower() then
Module.SetPlayerLevel(v, tonumber(TargetLevel))
end
end
end
end)
end
end)
ModuleScript For Checkpoints:
ServerScriptService>CheckpointModule
local module = {}
local Levels = {}
local CanGoDownInLevels = false
local RespawnDelay = 2
function module.GetPartFromLevel(Level)
for i,v in pairs(Levels) do
if v[2] == Level then
return v[1]
end
end
end
function module.SetPlayerLevel(Player, NewLevel)
Player:WaitForChild("leaderstats"):WaitForChild("Level").Value = NewLevel
end
function module.GetPlayerLevel(Player, NewLevel)
return Player:WaitForChild("leaderstats"):WaitForChild("Level").Value
end
local Initiated = false
function module.AddLevel(Part, Level)
if not Initiated then
Initiated = true
game.Players.CharacterAutoLoads = false
game.Players.PlayerAdded:Connect(function(NewPlayer)
local Folder = Instance.new("Folder", NewPlayer)
Folder.Name = "leaderstats"
local LevelValue = Instance.new("IntValue", Folder)
LevelValue.Name = "Level"
LevelValue.Value = 1
NewPlayer.CharacterAdded:Connect(function(NewCharacter)
repeat
wait(0.01)
until
NewCharacter:FindFirstChild("HumanoidRootPart") ~= nil
NewCharacter.HumanoidRootPart.CFrame = module.GetPartFromLevel(LevelValue.Value).CFrame + Vector3.new(0,5,0)
DiedConnection = NewCharacter:WaitForChild("Humanoid").Died:Connect(function()
wait(RespawnDelay)
NewPlayer:LoadCharacter()
DiedConnection:Disconnect()
end)
end)
NewPlayer:LoadCharacter()
end)
end
local Success = false
local PartIsInTable = false
local LevelIsInTable = false
for i,v in pairs(Levels) do
if v[1] == Part then
PartIsInTable = true
end
if v[2] == Level then
LevelIsInTable = true
end
end
if not PartIsInTable and not LevelIsInTable then
if Part:FindFirstChild("LevelGui") ~= nil then
Part["LevelGui"]["LevelText"].Text = Level
end
table.insert(Levels, {Part, Level})
Success = true
end
if Success then
Part.Touched:Connect(function(hit)
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if Player ~= nil then
--local PlayerCharacter = Player.Character or Player.CharacterAdded:Wait()
if CanGoDownInLevels then
module.SetPlayerLevel(Player, Level)
else
if module.GetPlayerLevel(Player) < Level then
module.SetPlayerLevel(Player, Level)
end
end
end
end)
end
end
function module.ClearLevels()
Levels = {}
end
function module.GetLevels()
return Levels
end
function module.RemoveLevelByLevel(Level)
for i,v in pairs(Levels) do
if v[2] == Level then
table.remove(Levels, i)
end
end
end
function module.RemoveLevelByPart(Part)
for i,v in pairs(Levels) do
if v[1] == Part then
table.remove(Levels, i)
end
end
end
return module
Script to add the checkpoints into the module:
ServerScriptService>CheckpointModule>Script
local Module = require(script.Parent)
for i,v in pairs(workspace.Checkpoints:GetChildren()) do
Module.AddLevel(v, v:WaitForChild("Level").Value)
end
Edit:
Since you are using the names of the part instead of the intvalue:
local Module = require(script.Parent)
for i,v in pairs(workspace.Checkpoints:GetChildren()) do
Module.AddLevel(v, tonumber(v.Name))
end
This is what is happening…
output shows nothing wrong.
Edit: yes i am streaming… ._.
So if i duplicate it would i have to change any scripting?
or just the intvalue?