Heya, so something really confusing to me… I am coding a simple checkpoint system for my roblox game I am working on. I tested the checkpoints in R15 and they worked perfectly, now in R6 they do absolutely nothing. They don’t even put an error in the console, I switched back to R15 to confirm the bug and it’s still there.
If anyone can help, that would be great. If not please like this so more people can!
Code:
local checkpoints = workspace.checkpoints
local datastore = game:GetService("DataStoreService"):GetDataStore("Stage")
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Model")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local stage = Instance.new("IntValue")
stage.Value = datastore:GetAsync(player.UserId, stage.Value) or 1
stage.Name = "Stage"
stage.Parent = leaderstats
player.CharacterAdded:Connect(function(character)
local humanoid = character:WaitForChild("Humanoid")
wait(character:MoveTo(checkpoints[stage.Value].Position))
character:MoveTo(checkpoints[stage.Value].Position)
humanoid.Touched:Connect(function(part)
if part.Parent == checkpoints then
if tonumber(part.Name) == stage.Value + 1 then
stage.Value = stage.Value + 1
end
end
end)
end)
end)
game.Players.PlayerRemoving:Connect(function(player)
local success, errormessage = pcall(function()
datastore:SetAsync(player.UserId, player.leaderstats.Stage.Value)
end)
if success then
print("saved stage for " .. player.Name)
else
warn(errormessage)
end
end)
game.Chat.BubbleChatEnabled = true
game.Players.RespawnTime = 0
Layout of the folder:
Thanks for reading this, and especially if you know how to fix it!
I don’t suggest this unless he wants the game to look old and boring. Just remove the model from the character that you parented to it or position the HumanoidRootPart instead.
This is just changing the leaderstat’s to a folder, which works. But i need to figure out why it’s only adding the stage +1 if you touch the part in r15 only.
R6 does not have a HumanoidRootPart, so when you try to move the Character to a checkpoint, the Character will stay in the same spot, even though you see the Character moving. You need to manually move the R6 character to the checkpoint using the Character’s Torso.