#Is this script interfering with respawn?
71 messages · Page 1 of 1 (latest)
** You are now Level 4! **
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
...```
basically it just handles events
oh wait i thought u meant the whole function
that just adds the players in the game
did you write this code?
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
chatgpt can't handle code longer than 4 lines 🙄
and even then still makes things up
i guess so, so do i just add the original script back?
what are you trying to do?
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
what kind of ragdoll?
did you make the ragdoll thing yourself, or toolbox?
or ai?
the ragdoll module i also stole but on youtube
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
yeah i know
the problem is probably somewhere in that code you copied
i've seen it copied wrong
comes up a lot...
it was like a modelthat i just had to ungroup and put in serverscriptservice
reset character in the roblox menu at the least should respawn as normal
no matter the condition of your character
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
i meant if you reset character while in that state, does it respawn you or no?
it did let me respawn like only 1-2 times sometimes then it wont let me respawn at all
it does not respawn me at all
it just goes back to where it started off and started regenerating my health
the one in the roblox menu?
no the reset button works fine
its just if im in ragdolled and im dead then the reset button wont work
what do you mean when you say respawned? coz of reset character works, then the character isn't dead, and i dont think your script will interfere with that unless it throws errors
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
maybe ill just try to modify the original script
frogger?
script errors?
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
so i'm testing some of this and this just kills the player
maybe you have a custom character loader
who knows how much other random stuff you have copied into your project 🤷
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
practice ;o
its probably the ondeathragdoll throwing an error when you click while dead-ragdolled expecting a respawn
who knows 🤷
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
refactor is easier than writing from scratch, so that's a good idea