#it only detects when i die once

1 messages · Page 1 of 1 (latest)

noble dust
#
    workspace:FindFirstChild(LP.Name).Humanoid.Died:Connect(function()
        print("death")
        
        workspace.AnimatedParts:WaitForChild("BossPart"):Destroy()
        local bosspart = Instance.new("Part")
        bosspart.Parent = workspace.AnimatedParts
        bosspart.Anchored = true
        bosspart.Name = "BossPart"
        bosspart.Size = Vector3.new(16,1,16)
        bosspart.Position = Vector3.new(28.275, 36.415, -239.785)
        local bosspart = workspace.AnimatedParts.BossPart
        local ts = game:GetService("TweenService")
        local info = TweenInfo.new(100, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false)
        local goal = {Position = Vector3.new(bosspart.Position.X, bosspart.Position.Y, -1400)}
        local tween2 = ts:Create(bosspart, info, goal)
        task.wait(8)
        tween2:Play()
    end)```
https://streamable.com/tpcez1

Watch "2025-07-12 13-42-20" on Streamable.

▶ Play video
short abyss
#

umm

#

are u asking it should move when u touch it?

#

and not when you die

#

cause ur code just checks if u die
workspace:FindFirstChild(LP.Name).Humanoid.Died:Connect

noble dust
#

it should run every time i die

noble dust
short abyss
#

ok

noble dust
# short abyss ok

You can see it prints "death" after i die once so it should print "death" again after i die again but its not and thats why am confused

short abyss
#

have it activative once you touch it and reset the position on death

#
local part = -- idk the part

part.Touched:Connect(function(hit)
    local humanoid = hit.Parent and hit.Parent:FindFirstChild("Humanoid")
    if humanoid then
        print("touched")

        local animatedParts = workspace:WaitForChild("AnimatedParts")
        local oldPart = animatedParts:FindFirstChild("BossPart")
        if oldPart then
            oldPart:Destroy()
        end

        local bosspart = Instance.new("Part")
        bosspart.Parent = animatedParts
        bosspart.Anchored = true
        bosspart.Name = "BossPart"
        bosspart.Size = Vector3.new(16, 1, 16)
        bosspart.Position = Vector3.new(28.275, 36.415, -239.785)

        local ts = game:GetService("TweenService")
        local info = TweenInfo.new(100, Enum.EasingStyle.Linear, Enum.EasingDirection.In)
        local goal = {Position = Vector3.new(bosspart.Position.X, bosspart.Position.Y, -1400)}
        local tween2 = ts:Create(bosspart, info, goal)

        task.wait(8)
        tween2:Play()
    end
end)
#
workspace:FindFirstChild(LP.Name).Humanoid.Died:Connect(function()
-- set the parts position and other things
end)
#

@noble dust

noble dust
#

alr

noble dust
#

i just want to know why it doesnt print "death" again even thought the player died

short abyss
#

cause you have to add that part

noble dust
short abyss
noble dust
short abyss
#

it wont do anything unless you die

noble dust
short abyss
#

what are you trying to achieve?

#

cause it looks like parkour on a moving block

noble dust
short abyss
noble dust
#

I have to go somewhere tho right now

noble dust
short abyss
#

add a wait()

eternal imp
#

try just wait for the character to load in

#

since its a localscript it might be running it before the full char is loaded in

noble dust
short abyss
eternal imp
#

oh you already are

#

its only running once?

noble dust
#

it only prints "death" after i die once

#

GTG

short abyss
#

ohh i understand

eternal imp
#

where is the script?

short abyss
eternal imp
#

i mean where is it in workspace

short abyss
#

idk he left

eternal imp
#

oh starterplayer

#

@noble dust

#

put it in startercharacter

#

that will it will load onto the character every time u die

#

and re run

#

player only loads once

#

i think

#

only reason i can think of rn

short abyss
eternal imp
#

try put it in startercharacter first

#

then lmk

#

@noble dust

west fulcrum
#

Maybe try to get the character without doing "workspace:findfirst..."

#

Like u get the character

#

Cuz when u die

#

Character is reset

#

So maybe if u get the player.Character then it will give u the new character

#

You see what do i mean?

#

The first time it works perfectly, but on the next death it was the death of another characater

#

@noble dust

#

Im sure this will work

#

Let me know

eternal imp
#

or try put it in startercharacter

#

matter of fact why are u using player service to get localplayer in a localscript

noble dust
noble dust
noble dust
#

same thing happens

#

as in the video

noble dust
#

is there another way?

#

thats how i have always done it

#

i think i just saw it in some video and used it

noble dust
noble dust
#

btw this is the entire script in case its because of a different line

noble dust
#

bro nothing works

#

i dont understand

noble dust
#

hey do any of u guys know how do i wait for the game to load before i load

#

cuz if i have bad internet my script always tell me attempt to index nil with waitforchild

#

but if i have good internet it wont give me that error

noble dust
#

@eternal imp

#

@short abyss

#

@west fulcrum

west fulcrum
#

And then

#

Add a line of code where you will define the character on top

#
local Character = Player.Character or Player.CharacterAdded:Wait()
#

If it still dont work tell me and ill check ur entire script then

noble dust
#

what is player

#

how do i get player

west fulcrum
#

by game.Players.LocalPlayer

noble dust
noble dust
west fulcrum
#

until its fire

noble dust
#

oh ok

noble dust
#

also it has a problem which is the reason why i put it in starterplayerscripts

#

because if the player dies the whole script will rerun

#

i have to go to bed now @west fulcrum

eternal imp
west fulcrum
#

ill check the script soon dont worry then

noble dust
west fulcrum
#

yes sorry

#

wait

#

the only problem is just that the script is not organised

#

so its a bit hard to see

#

i suggest you to locate some variables etc

#

anyways

#

@noble dust

#

is your script on starter player right?

noble dust
#

alr

noble dust
west fulcrum
#

alr

#

the error is here then

#

you need to put it on starter character

#

when its in starter character

#

each time u die its get back the old char

#

so it rerun the script

noble dust
noble dust
west fulcrum
#

put the script in starter character

#

@noble dust so?

noble dust
#

no

#

starter character doesnt work

#

and doesnt change anything

west fulcrum
#

is the died event must be in the same local script?

#

cuz if no then i can make u one quickly so it works

noble dust
#

@west fulcrum

#

i have been simplfying and playing and testing the script a LOT

#

and

#

i figured it out

#

deleteing the

#

last lines after the function

#
    screengui.Enabled = true
    talk("YOU KNOW WHAT YOU DID")
    screengui.Enabled = false```
#

in the orginal script

#

but i dont really know why this works

#

here is it simplifed

#

i tired to make it more orangized like u said

eternal imp
noble dust
eternal imp
#

that pauses the thread instead of creating a new one

#

so when ur dying again right after

#

the thread is still paused

noble dust
#

oh

eternal imp
#

and the code cant run

#

and since u keep rerunning that section

noble dust
#

so how can i do this

eternal imp
#

the thread is probably just infinitely paused

#

do u want it to wait 15 seconds?

#

task.spawn(function()
wait(15)
)

#

smthn like that

#

this will make a new thread that can get paused

noble dust
#

oh

#

okay

noble dust
#

something like repeat game:IsLoaded()?

eternal imp
#

look into contentprovider

#

preloadasync i think