#I need help

121 messages · Page 1 of 1 (latest)

daring scaffold
#

i can help

#

if ur willing to pay. (its basically me making you a script)

twin hornet
#

well I have a few scripts they might js need a few touch ups

crystal tapir
#

Need more context

#

But basically, you can number the checkpoints manually and just :PivotTo() the character to workspace.Checkpoints[stage]

twin hornet
#

1

#

2

#

3

#

since I only have 3 currently

crystal tapir
#

yes

#

cool

#

do what i showed

twin hornet
#

im lowk new

#

I use

#

ai and tutorials

#

and my own brain knowledge

#

ill send u all the scripts im using

#
-- Script in each checkpoint part (e.g., Checkpoint1, Checkpoint2, ...)
local checkpointNumber = tonumber(script.Parent.Name:match("%d+"))  -- Extract number from part name

script.Parent.Touched:Connect(function(hit)
    local humanoid = hit.Parent:FindFirstChildOfClass("Humanoid")
    if humanoid then
        local player = game.Players:GetPlayerFromCharacter(humanoid.Parent)
        if player then
            local leaderstats = player:FindFirstChild("leaderstats")
            if leaderstats then
                local stage = leaderstats:FindFirstChild("Stage")
                if stage then
                    if stage.Value < checkpointNumber then
                        stage.Value = checkpointNumber
                        print(player.Name .. " reached stage " .. checkpointNumber)
                    else
                        print(player.Name .. " already passed this checkpoint")
                    end
                else
                    print("Stage value not found in leaderstats for " .. player.Name)
                end
            else
                print("Leaderstats not found for " .. player.Name)
            end
        else
            print("Player not found for touched object")
        end
    end
end)
#

this is the script that i placed in all 3 checkpoints

twin hornet
# crystal tapir do what i showed
-- Define initial spawn point
local initialSpawnPosition = game.Workspace.SpawnLocation  -- Replace with your actual spawn point name

-- Function to respawn player at initial spawn point
local function respawnAtInitialSpawn(player)
    local character = player.Character
    if character then
        character:Destroy()
    end
    local newCharacter = player.CharacterAdded:Wait()
    newCharacter:SetPrimaryPartCFrame(initialSpawnPosition.CFrame)
end

-- Handle player join
game.Players.PlayerAdded:Connect(function(player)
    -- Create leaderstats for player
    local leaderstats = Instance.new("Folder")
    leaderstats.Name = "leaderstats"
    leaderstats.Parent = player

    -- Create stage stat for player
    local stage = Instance.new("IntValue")
    stage.Name = "Stage"
    stage.Value = 1  -- Start at stage 1
    stage.Parent = leaderstats

    -- Respawn player at initial spawn
    respawnAtInitialSpawn(player)

    -- Handle respawn after death
    player.CharacterAdded:Connect(function(character)
        local lastCheckpoint = player:GetAttribute("LastCheckpoint")
        if lastCheckpoint then
            -- Teleport player to last checkpoint
            local spawnPosition = game.Workspace:FindFirstChild("Checkpoint" .. lastCheckpoint)
            if spawnPosition then
                character:SetPrimaryPartCFrame(spawnPosition.CFrame)
            else
                warn("Last checkpoint not found for " .. player.Name)
                -- Fallback to initial spawn if checkpoint not found
                respawnAtInitialSpawn(player)
            end
        else
            -- Fallback to initial spawn if no last checkpoint attribute
            respawnAtInitialSpawn(player)
        end
    end)
end)

-- Handle player leaving
game.Players.PlayerRemoving:Connect(function(player)
    -- Save last checkpoint to player attributes
    local stage = player.leaderstats.Stage.Value
    player:SetAttribute("LastCheckpoint", stage)
end)
#

this is the respawn script

#
-- Script in ServerScriptService or a LocalScript in a Player object

game.Players.PlayerAdded:Connect(function(player)
    -- Create leaderstats folder
    local leaderstats = Instance.new("Folder")
    leaderstats.Name = "leaderstats"
    leaderstats.Parent = player

    -- Create stage value
    local stage = Instance.new("IntValue")
    stage.Name = "Stage"
    stage.Value = 1  -- Start at stage 1
    stage.Parent = leaderstats
end)
#

this is the leaderstats script

#

everything works other than

#

I don't spawn on the checkpoints

twin hornet
#

youtube didn't work

half sluiceBOT
#

studio** You are now Level 1! **studio

twin hornet
#

mine didn't work

#

i was js sick of it

#

I've been doing this for 4 hours

#

like no joke

crystal tapir
#

learn to script

twin hornet
#

only break i took was to shower n eat

crystal tapir
#

im not reading all that

twin hornet
#

I'm in basics

#

and this is "basics"

crystal tapir
#

i could easily find the error

#

checkpoints are being searched for directly under workspace

#

with the name "CheckpointX" X being the checkpoint number

twin hornet
#

as this

#

folder named "Checkpoints"

crystal tapir
#

no

#

just

twin hornet
#

and checkpoints named "1, 2, 3"

crystal tapir
#

workspace.Checkpoint1

#

workspace.Checkpoint2

#

etc

#

thats what the script is searching for

#

learn basic scripting, that way you wont need help on basic stuff like this.

twin hornet
#

short-term memory loss goin crazy rn fr

#

lmfao

#

im trying

#

js wanna also make a game

#

earn robux

#

and hire devs instead

#

I didn't spawn on checkpoint

#

I also have spawn locations

#

for when people first join the game

crystal tapir
twin hornet
#

they spawn on those

twin hornet
crystal tapir
#

a million people have tried the same thing

#

you cant just

#

"make a game and earn robux"

#

you might be able to "make a game"

twin hornet
#

yeah

#

it might work

#

might not

crystal tapir
#

but "earn robux"?

#

its REALLY not that easy

twin hornet
#

its js an obby game yk

crystal tapir
#

you need skill to even make 10 robux

twin hornet
#

its simple js

#

this is not working idk why

crystal tapir
#

if a game is struggling to even have checkpoints

#

it wont make any robux

twin hornet
#

it will

#

I will prove it too

crystal tapir
crystal tapir
twin hornet
#

alright

twin hornet
crystal tapir
#

the script is searching for checkpoints that are under workspace with the name "CheckpointX"

twin hornet
#

I fixed that

#

tested

#

and still has the same error

crystal tapir
#

In workspace

#

not in a folder

twin hornet
#

oh

#

how can I make it

#

where

#

it works in a folder

#

btw

#

that didn't work

#

: )

crystal tapir
#

im not editing a script for you

twin hornet
half sluiceBOT
#

studio** You are now Level 2! **studio

twin hornet
#

your method did NOT work

crystal tapir
#

womp womp

#

i skimmed the code

#

that was one of the issues

twin hornet
#

welp

#

didn't work

crystal tapir
#

womp womp

#

learn to script

#

make your own code

#

you'll make games 10000% faster

#

trust me

twin hornet
#

yeah this is the only thing i really need

twin hornet
#

everything is almost complete gang

#

js working on map

crystal tapir
#

womp womp