#script doesnt work
1 messages · Page 1 of 1 (latest)
local Players = game:GetService("Players")
local DataStoreService = game:GetService("DataStoreService")
local checkpointStore = DataStoreService:GetDataStore("CheckpointStore")
local checkpointPart = workspace:FindFirstChild("TPSpawn")
-- Cria ProximityPrompt na parte, se não existir
local prompt = checkpointPart:FindFirstChildOfClass("ProximityPrompt")
if not prompt then
prompt = Instance.new("ProximityPrompt")
prompt.ActionText = "Salvar Checkpoint"
prompt.ObjectText = "Checkpoint"
prompt.HoldDuration = 0 -- ativar com um toque simples
prompt.Parent = checkpointPart
end
-- Debounce para evitar múltiplos salvamentos rápidos
local debounce = {}
prompt.Triggered:Connect(function(player)
if debounce[player.UserId] then return end
debounce[player.UserId] = true
local character = player.Character
if character then
local root = character:FindFirstChild("HumanoidRootPart")
if root then
local pos = root.Position
local data = {X = pos.X, Y = pos.Y, Z = pos.Z}
local success, err = pcall(function()
checkpointStore:SetAsync(tostring(player.UserId), data)
end)
if success then
print("Checkpoint salvo para "..player.Name)
-- Set TPSpawn as the player's respawn location
player.SpawnLocation = checkpointPart
else
warn("Erro ao salvar checkpoint:", err)
end
end
end
task.wait(5) -- tempo para evitar spam
debounce[player.UserId] = false
end)
Players.PlayerAdded:Connect(function(player)
local success, data = pcall(function()
return checkpointStore:GetAsync(tostring(player.UserId))
end)
if success and data then
local pos = Vector3.new(data.X, data.Y, data.Z)
-- Set TPSpawn as the player's respawn location
player.SpawnLocation = checkpointPart - first part of script
-- Teleport player to their checkpoint position on spawn
player.CharacterAdded:Connect(function(character)
local root = character:WaitForChild("HumanoidRootPart", 5)
if root then
root.CFrame = CFrame.new(pos)
~~ end~~
end)
print("Checkpoint carregado para "..player.Name)
else
-- If no checkpoint, clear RespawnLocation
player.SpawnLocation = nil
if not success then
warn("Erro ao carregar checkpoint:", data)
end
end
end) - second part of script
i mean i didnt put second part or first part in the script of course bhut i just dont know what to do
Ask ChatGPT again
what
sayng this wont help bro
chatgpt scripts are even worse than this bro.
ok
anyone?
ChatGPT done goofed, ask it again.
or you can learn how to code properly and learn how to do it correctly https://create.roblox.com/docs/tutorials/fundamentals/coding-1/coding-fundamentals
i didnt use chatgpt bro, i used the roblox ia, i can understand scripts the real problem is i dont know how to use the scripts, ive already learned about everything dude, variables, functions, etc, i just cant write this shit bro, this pmo
tutorials aint explaining shit
my brain weak bro, i cant understand what should i write next to make some real code bro.
there are some words that i need to use that i dont understand bro, no one mentions that words bro
these guides dont mention about findfirstchild and some other things, i can read and compreheend everything i n the script i just dont know what is wrong dude, cuz the analysis dont say shit bro.
Roblox Documention mentioned about everythings: Found in 1 seconds:
https://create.roblox.com/docs/reference/engine/classes/Instance#FindFirstChild
i already know about findfirshchild, i just mean some other things just are not explained how to do, like where do i need to put spaces bro, if i put one space in the wrong place it just breaks the script,
for example this part: player.SpawnLocation = checkpointPart
else
warn("Erro ao salvar checkpoint:", err)
end
end
end
how would i know that else comes 2 letters before warn?
or this part: if success and data then
local pos = Vector3.new(data.X, data.Y, data.Z)
-- Set TPSpawn as the player's respawn location
player.SpawnLocation = checkpointPart - first part of script
how would i know that local pos comes a litlle more spaced than above

I mean, if you prefer, you can do it without spaces.
But i gonna say, good luck reading the code after, trying to figuring out why isn't working.
the output said it was because of respawnpoint that should be replaced with spawnpoint, and i replaced and guess what? doesnt work
basically the error didnt change anything
fixing the error didnt make the script work