#how to make checkpoints save when leaving

135 messages · Page 1 of 1 (latest)

echo grove
#

here is the leaderstats code


local players = game:GetService("Players")
players.PlayerAdded:Connect(function(plr)
    
    plr.CharacterAppearanceLoaded:Connect(function(char)
        task.wait(0.1)
        local HRP = char:WaitForChild("HumanoidRootPart")
        local lds = plr:WaitForChild("leaderstats")
        local stage = lds:WaitForChild("Stage")
        local PartsFolder = workspace:WaitForChild("StageParts")
        local part = PartsFolder:FindFirstChild(stage.Value)
        HRP.Position = part.Position + Vector3.new(0,5,0)
    end)

local folder = Instance.new("Folder",plr)
    folder.Name = "leaderstats"

    local NumberValue = Instance.new("NumberValue",folder)
    NumberValue.Name = "Stage"

end)
umbral marlin
#

also

#

local folder ....

#

you forgot to put folder.parent

#

and i dont recommend you doing folder as the name

echo grove
#

wdym im kinda new

umbral marlin
#

just put local leaderstats or local leaderstatsFolder

umbral marlin
echo grove
#

oh chance local folder

#

change

#

to local leaderstats

umbral marlin
#

so ```lua
hi

echo grove
#

lemme see if it will work

umbral marlin
#

oh

#

its just a name

#

if you want stuff to store

echo grove
#

oh

#

ye

umbral marlin
#

you'll need datastores

echo grove
#

how

umbral marlin
#

and dont even mind about that until you're 2 month experienced

#

just dont mind it

echo grove
#

oh but i kinda need it pretty quickly

umbral marlin
#

are you making a game?

#

solo?

echo grove
#

ye

umbral marlin
#

dont do that

#

even if you're not solo

#

dont do that at your level

#

you wanna earn money?

#

do commissions

#

but not now

#

LEARN first MONEY second

#

:3

echo grove
#

ok

left jasperBOT
#

studio** You are now Level 3! **studio

slender elbow
#

Mmmmm

echo grove
#

checkpoint.Touched:Connect(function(hit)
    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
    if player then
        if not player:FindFirstChild("leaderstats") then
            local leaderstats = Instance.new("Folder")
            leaderstats.Name = "leaderstats"
            leaderstats.Parent = player

            local checkpointStat = Instance.new("IntValue")
            checkpointStat.Name = "Checkpoint"
            checkpointStat.Value = 1
            checkpointStat.Parent = leaderstats
        end

        local checkpointStat = player.leaderstats.Checkpoint
        local checkpointID = checkpoint:FindFirstChild("CheckpointID")

        if checkpointID and checkpointStat.Value ~= checkpointID.Value then
            checkpointStat.Value = checkpointID.Value
        end
    end
end)
#

Also have number values for each checkpoint

#

But im not spawning at the right checkpoints

#

@umbral marlin canu help

umbral marlin
#

what's the issue

echo grove
#

im not spawning at the checkpoint when i died

umbral marlin
#

checkpoint ID is the same number value as script.parent right?

#

wait

#

that's not the whole script is it 💀

echo grove
#

it is...

umbral marlin
#

@echo grove add GglGgl132 and go to team create and add me as editor, i'll help you

#

its faster for me

echo grove
#

ok

#

added

#

@umbral marlin

#

i added you

umbral marlin
#

accepted @echo grove

echo grove
#

ok

#

i inv

#

u

#

and made u edit

umbral marlin
#

alr

echo grove
#

i gtg make any adjmusments u need

umbral marlin
#

@echo grove

#

you set the checkpoint but you didnt make the player spawn in that checkpoint

echo grove
#

it still doesnt work

#

@umbral marlin

#

@umbral marlin

umbral marlin
#

show me your spawning code

#

im busy with a commission

echo grove
#

tbh thats the thing

#

i dont have it..

#

i need help with that

#

@umbral marlin

umbral marlin
#

try asking gemini

echo grove
#

ok

echo grove
#

@umbral marlin

left jasperBOT
#

studio** You are now Level 4! **studio

echo grove
#

Its not working im getting frustrated i told chat gpt but it didnt work

umbral marlin
#

gemini

#

chatgpt will never work

#

@echo grove

echo grove
#

alright

slender elbow
umbral marlin
#

cuz gemini is updated

#

chatgpt is 2020

slender elbow
umbral marlin
slender elbow
umbral marlin
#

no\

slender elbow
#

I've always seen Gemini as a piece of hot trash

umbral marlin
echo grove
# umbral marlin yea same until i used it 💀

why isnt the laser killing me ``` -- Part to shoot lasers from
local laserPart = workspace.LaserPart

-- Laser properties
local laserColor = Color3.new(1, 0, 0)
local laserThickness = 0.1
local laserLength = 50

-- Cooldown between laser shots
local cooldown = 1

-- Damage amount
local damage = 10

-- Function to create and fire a laser (CORRECTED and TESTED)
local function fireLaser()
-- Create the laser beam (same as before)
local laserBeam = Instance.new("Part")
-- ... (Laser beam creation and positioning code - same as before)

-- Destroy the laser after a short time (same as before)
delay(0.2, function()
    laserBeam:Destroy()
end)

-- Damage players hit by the laser (CORRECTED RAYCAST and DAMAGE)
local raycastParams = RaycastParams.new()
raycastParams.FilterType = Enum.RaycastFilterType.Exclude
raycastParams.FilterDescendantsInstances = {laserPart, laserBeam}

local raycastResult = workspace:Raycast(laserPart.Position, laserPart.CFrame.LookVector * laserLength, raycastParams)

if raycastResult then
    local hitPart = raycastResult.Instance
    local humanoid = hitPart.Parent:FindFirstChild("Humanoid")

    if humanoid then
        -- Apply damage directly to the Humanoid (FINALLY!)
        humanoid:TakeDamage(damage)  -- This is the correct way to apply damage
    end
end

end

-- Automatic firing loop (always on)
local function autoFireLoop()
while true do
fireLaser()
wait(cooldown)
end
end

coroutine.wrap(autoFireLoop)() -- Start the auto-fire loop

print("Laser script initialized. Laser firing automatically.")```

umbral marlin
#

hmm

#

what's the output

#
 -- Part to shoot lasers from
local laserPart = workspace.LaserPart

-- Laser properties
local laserColor = Color3.new(1, 0, 0)
local laserThickness = 0.1
local laserLength = 50

-- Cooldown between laser shots
local cooldown = 1

-- Damage amount
local damage = 10

-- Function to create and fire a laser (CORRECTED and TESTED)
local function fireLaser()
    -- Create the laser beam (same as before)
    local laserBeam = Instance.new("Part")
    -- ... (Laser beam creation and positioning code - same as before)

    -- Destroy the laser after a short time (same as before)
    delay(0.2, function()
        laserBeam:Destroy()
    end)

    -- Damage players hit by the laser (CORRECTED RAYCAST and DAMAGE)
    local raycastParams = RaycastParams.new()
    raycastParams.FilterType = Enum.RaycastFilterType.Exclude
    raycastParams.FilterDescendantsInstances = {laserPart, laserBeam}

    local raycastResult = workspace:Raycast(laserPart.Position, laserPart.CFrame.LookVector * laserLength, raycastParams)

    if raycastResult then
        local hitPart = raycastResult.Instance
        local humanoid = hitPart.Parent:FindFirstChild("Humanoid")

        if humanoid then
            -- Apply damage directly to the Humanoid (FINALLY!)
            humanoid:TakeDamage(damage)  -- This is the correct way to apply damage
        end
    end
end

-- Automatic firing loop (always on)
local function autoFireLoop()
    while true do
        fireLaser()
        wait(cooldown)
    end
end

coroutine.wrap(autoFireLoop)() -- Start the auto-fire loop

print("Laser script initialized.  Laser firing automatically.")
#

sounds like a chatgpt code

left jasperBOT
#

studio** You are now Level 9! **studio

echo grove
umbral marlin
#

and also

echo grove
umbral marlin
#

hitpart = raycastresult.instance

#

you might be clicking the accessories

#

and the parent of the accessories is a part and not character

#

try typing print hitpart.parent

echo grove
#

its not a gun

#

its a dispenser

#

like an obby thingy

echo grove
umbral marlin
#

where do you think it is 💀

echo grove
umbral marlin
echo grove
slender elbow
echo grove
#

@slender elbow

slender elbow
echo grove
slender elbow
echo grove
#

ok

#

wait

#

i will send

#

you

#

local mps = game:GetService("MarketplaceService")
local gamepassId = script.GamepassID.Value

mps.PromptGamePassPurchaseFinished:Connect(function(plr,passId,purchased)
if purchased then
script["Speed Coil"]:Clone().Parent = plr.Backpack
end
end)

game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function()
local ownsPass = mps:UserOwnsGamePassAsync(plr.UserId,gamepassId)
if ownsPass then
script["Speed Coil"]:Clone().Parent = plr.Backpack
end
end)
end)

#

local mps = game:GetService("MarketplaceService")

local plr = game.Players.LocalPlayer

script.Parent.TextButton.MouseButton1Click:Connect(function()
local owns = mps:UserOwnsGamePassAsync(plr.UserId,script.Parent.GamepassID.Value)
mps:PromptGamePassPurchase(plr,script.Parent.GamepassID.Value)
if owns then
script.Parent.TextButton.Text = "Speed Coil Owned"
end
end)

#

@slender elbow

#

@umbral marlin

echo grove
left jasperBOT
#

studio** You are now Level 5! **studio

umbral marlin
#

sry i was gone for bible camp 🥶