#Is this script interfering with respawn?

71 messages · Page 1 of 1 (latest)

quasi notch
#

ever since i re-scripted this to be more flexible, dying while ragdolled isn't gonna let you respawn. if you want i can also give the ragdoll module it may be the cause of the problem..

grave hingeBOT
#

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

shrewd merlin
# quasi notch ever since i re-scripted this to be more flexible, dying while ragdolled isn't ...

that script connects to player.CharacterAdded, so it could be.

what is this snippet of your code supposed to do?

...
-- Function: Ball click handler
function ballClicked(player)
    -- Add all valid players to the game
    for _, playerp in pairs(Players:GetPlayers()) do
        if playerp.Character and playerp.Character:WaitForChild("Humanoid").Health > 0 then
            if not table.find(playersInGame, playerp) then
                table.insert(playersInGame, playerp)
                replicatedStorage.EventStarted:FireAllClients()
                replicatedStorage.BallClicked:FireAllClients(player)  -- Fire event to clients
                print("fired all events.")

                -- Define player death handling
                local diedFunction = function()
                    print(playerp.Name .. " died!")
                    table.remove(playersInGame, table.find(playersInGame, playerp))
                    replicatedStorage.PlayerDied:FireAllClients(playerp)

                    -- Reconnect on respawn
                    playerp.CharacterAdded:Connect(function(character)
                        character:WaitForChild("Humanoid")
                        if not table.find(playersInGame, playerp) then
                            table.insert(playersInGame, playerp)
                            print(playerp.Name .. " has respawned and rejoined the game.")
                        end
                    end)
                end

                -- Clean up existing connections
                if connections["connection1"] then
                    connections["connection1"]:Disconnect()
                end

                connections["connection1"] = playerp.Character:WaitForChild("Humanoid").Died:Connect(diedFunction)
            end
        end
    end
...```
quasi notch
#

oh wait i thought u meant the whole function

#

that just adds the players in the game

shrewd merlin
#

did you write this code?

quasi notch
#

only half of it before encountering alot of problems

#

then i had to ask ai but before it was a bit more simple

for _, playerp in pairs(Players:GetPlayers()) do
    if playerp.Character:WaitForChild("Humanoid").Health ~= 0 then
        if not table.find(playersInGame, playerp) then
            --print(playerp.Name)
            table.insert(playersInGame, playerp)
            replicatedStorage.EventStarted:FireAllClients()
            local diedFunction = function ()
                print(playerp.Name.. " dieded so hard lole!!!!!")
                table.remove(playersInGame, table.find(playersInGame, playerp))
                replicatedStorage.PlayerDied:FireAllClients(playerp)
            end

            connections["connection1"] = playerp.Character:WaitForChild("Humanoid").Died:Connect(diedFunction)
        end
    end
end
shrewd merlin
#

chatgpt can't handle code longer than 4 lines 🙄

#

and even then still makes things up

quasi notch
#

i guess so, so do i just add the original script back?

shrewd merlin
#

what are you trying to do?

quasi notch
#

well im trying to make the game stop making me not respawn if im ever ragdolled

#

cause for some reason if i die while ragdolled i wont even respawn at all

#

but if i die normally (wont ragdoll me or just use the on death ragdoll i stole on free models) it will let me respawn

#

and ive been trying to like fix this for days on end ever since i changed the MainGame script

shrewd merlin
#

what kind of ragdoll?

#

did you make the ragdoll thing yourself, or toolbox?

#

or ai?

quasi notch
#

the ragdoll module i also stole but on youtube

shrewd merlin
#

that's not that much better

#

better, but not by much

quasi notch
#

this is like the script itself

local ragdoll = {}

function ragdoll.Start(character)
local hum = character:FindFirstChild("Humanoid")
if not hum then return end

local ragdollValue = character:FindFirstChild("Ragdoll")
if not ragdollValue then
    ragdollValue = Instance.new("BoolValue")
    ragdollValue.Name = "Ragdoll"
    ragdollValue.Value = false
    ragdollValue.Parent = character
end

if ragdollValue.Value then return end
ragdollValue.Value = true

for _, joint in pairs(character:GetDescendants()) do
    if joint:IsA("Motor6D") then
        local socket = Instance.new("BallSocketConstraint")
        local a0 = Instance.new("Attachment")
        local a1 = Instance.new("Attachment")

        a0.Parent = joint.Part0
        a0.CFrame = joint.C0
        a1.Parent = joint.Part1
        a1.CFrame = joint.C1

        socket.Parent = joint.Parent
        socket.Attachment0 = a0
        socket.Attachment1 = a1
        socket.LimitsEnabled = true
        socket.TwistLimitsEnabled = true

        joint.Enabled = false
    end
end

hum.WalkSpeed = 0
hum.JumpPower = 0
hum.PlatformStand = true
hum.AutoRotate = false

end

function ragdoll.Stop(character)
local hum = character:FindFirstChild("Humanoid")
if not hum then return end

local ragdollValue = character:FindFirstChild("Ragdoll")
if ragdollValue then
    ragdollValue.Value = false
end

for _, joint in pairs(character:GetDescendants()) do
    if joint:IsA("BallSocketConstraint") then
        joint:Destroy()
    elseif joint:IsA("Motor6D") then
        joint.Enabled = true
    end
end

hum.PlatformStand = false
hum:ChangeState(Enum.HumanoidStateType.GettingUp)
hum.WalkSpeed = 16
hum.JumpPower = 50
hum.AutoRotate = true

end

return ragdoll

shrewd merlin
#

the problem is probably--

#

i'm not debugging random youtube tutorials for you

quasi notch
#

yeah i know

shrewd merlin
#

the problem is probably somewhere in that code you copied

#

i've seen it copied wrong

#

comes up a lot...

quasi notch
#

it was like a modelthat i just had to ungroup and put in serverscriptservice

shrewd merlin
#

no matter the condition of your character

quasi notch
#

yeah but it also lets me respawn if i use a killbrick

#

but when i get ragdolled and then i hit a killbrick

#

then i wont respawn at all

shrewd merlin
quasi notch
#

it did let me respawn like only 1-2 times sometimes then it wont let me respawn at all

quasi notch
#

it just goes back to where it started off and started regenerating my health

shrewd merlin
quasi notch
#

no the reset button works fine

#

its just if im in ragdolled and im dead then the reset button wont work

shrewd merlin
#

idk this is what happens when you try to mash together ai code with toolbox code and expect things to work

#

you're working with forces you dont understand :/

#

you can maybe post a job in #💵︱hiring and someone may be interested to fix your weird ragdoll and tutorial copy

shrewd merlin
#

frogger?

quasi notch
#

huh

#

ok yeah no the mainmodule is the problem 😭

shrewd merlin
#

script errors?

quasi notch
#

none

#

i just know it is the mainmodule cause if i disable it while the on death ragdoll is still enabled it would let me respawn

#

and if i enable mainmodule but disable the other one it wont let me respawn

shrewd merlin
#

maybe you have a custom character loader

#

who knows how much other random stuff you have copied into your project 🤷

quasi notch
#

i only used the ondeathragdoll and also the mainmodule

#

and a sign cause i cant figure out sufarcegui

#

thats all i borrowed in the toolbox

shrewd merlin
#

practice ;o

shrewd merlin
#

who knows 🤷

quasi notch
#

eh maybe ill js try to make a custom ragdoll script that might work with the game

#

actually nvm ill just rescript everything that needed a ragdoll to just do different things

shrewd merlin
#

refactor is easier than writing from scratch, so that's a good idea

quasi notch
#

Found the problem, basically the ragdoll script is interferring with the player, it literally disables respawning after death, even without Ai's modification

#

i guess that "best way to make ragdolls!" wasnt the best way