#custom respawn system not functioning correctly

1 messages · Page 1 of 1 (latest)

zenith dew
#

please don't be rude or passive aggressive, i'm new to roblox lua and i'm around the intermediate stage i would say, all i want is just a little bit of help fixing this

so my project has custom characters, two of them to be exact and they are team based, so with that i have to create a custom respawn system since the regular roblox respawn system doesn't function well with my models (it resets the player back to their avatar)

i keep having this glitch where the character stays dead after dying, never respawns. i've been trying multiple things like using loadcharacter after dying but that breaks the whole script, anyone have any ideas on how to fix this? also i want methods to improve my script over all, as well, if anyone is willing to provide that
i'm not asking for a new script btw just some help with the glitch that keeps happening and some ways to improve but really what i seriously need is the glitch to be fixed LOL.

(this is a script in the serverscriptservice)

#

i can also provide a video of the output and when u die just for a better understanidning

zenith dew
#

okie dokie

#

gimme a second then

#

uhm okay one second i have to change the script a little bit bc fpr some reason the character change isn't working now gimme a moment

#

from what it looks like it doens't seem like the humanoid.died event is firing at all

rich reef
#

hmm

#

do u have

#

actually ok

#

publish

#

and test it in game

#

im guessing it should work there

zenith dew
#

hmmm rlly? alr one second then

#

but yeah ut's published lemme try it there then

#

why should it work there though?

rich reef
#

so characteradded doesnt fire

zenith dew
#

ah damn alr makes sense

#

i usually use studio to test features, should i instead do it in the actual roblox player?

rich reef
#

not really

#

there is a way to

#

solve this

zenith dew
#

hmmmm teach me then

rich reef
#

ok

#

so when player loads

#

server shouldnt auto spawn them

#

so disable autoloadcharacter or whatever the setting was called

zenith dew
#

shit one seocnd i'm opening roblox i can't use discord when it's open cuz my pc is crap

rich reef
#

when players game is finished loading

#

it should fire a remote to server

#

then the server should spawn them

zenith dew
#

nah nvm same glitch happens in the player too

rich reef
#

hm ok lemme check the script

zenith dew
#

alrighty

zenith dew
#

yeah makes ense

#

sense

#

gosh i had this feeling that i should've been using remote events the whole time yeah makes sense

rich reef
#

a

#

@zenith dew

#

aight so

zenith dew
#

yeh?

rich reef
#

your respawning the player

#

BEFORE u add the characteradded evnt

#

change the places of those

zenith dew
#

oh frigg

#

hmmmm

#

i thought the loadcharacter function created a new character though
when i didn't add it, the character didn't spawn at all

#

the newmodel function only affects existing characters

rich reef
#

no no

#

ok look

#

ur telling the server to track new characters

#

but u respawn the player before telling the server to track

#

so when u respawn the characteradded doesnt run

#

the characteradded code there should be at the top

#

then u should respawn the player

zenith dew
#

hmmmm alright yeah i get it

#

i think hmmm

#

so how would i write the code?

rich reef
#

just put the player:LoadCharacter() and newmodel part at the bottom

rich reef
zenith dew
#

okay so
under characteradded?

rich reef
#

no outside

#

have characteradded connected first

zenith dew
#

okay er alright one second

#

so at the bottom of this whole

thing

#

like that? or not

rich reef
#

yes

zenith dew
#

alright awesome

#

hmmm okay

#

so should i create this into a remote event now?

#

or is there more changes i should make still

rich reef
#

nah that remote event thing is

#

not always needed

zenith dew
#

okay

rich reef
#

what ur doing is fine

zenith dew
#

alrighty then
so should i test it and see if it works now?

rich reef
#

y

zenith dew
#

okie

#

OH UHM OKAY SO THE OUTPUT IS BEING SPAMMED RN

#

IT KEEPS RELOADING MY CHRACTER WTF

rich reef
#

uhh

#

i dont think

#

player.Character

#

would work

zenith dew
#

huh why not?

#

also it gave thjis

rich reef
#

well i never saw someone setting player.character before

zenith dew
#

i'm guesisng that's just random eror rthough

#

oh srsly?

rich reef
#

it has to do with ur custom character i am guessing

#

u sure ur custom character is alive?

zenith dew
#

i seen alotta ppl on the dev forum using player.character

#

yeah

#

it has health n all

zenith dew
rich reef
#

actually

#

remove newmodel from the bottom

#

u do it inside characteradded anyway

zenith dew
#

alrighty

rich reef
#

also should change ur logic inside humanoid.died

#

teleport the player inside characteradded not

#

humanoid died

#

humanoid died should just call loadcharacter after a wait

deft horizon
#

yo can rq paste the script in

zenith dew
#

aaaaand alright it's still spamming

zenith dew
#

sense*

zenith dew
deft horizon
#

okay thats good

zenith dew
#

alr nvm it just keeps respawning me

#

idfk why it's acting like there's some kind of while loop it just keeps doing this one thing over and over again

rich reef
#

remove newmodel and try işt again

#

try to narrow it down

zenith dew
#

inside characteeradded?

fickle kettleBOT
#

studio** You are now Level 6! **studio

rich reef
#

so we can find which function is

#

causing it

zenith dew
#

alright
i tried it and it stopped spamming and reloading my character constantly

#

so yeah i think it has smthn to do with the newmodel function then

deft horizon
#

is characterautoloads on or off

zenith dew
#

off

deft horizon
#

k

rich reef
#

ye im thinking the way u set ur custom character is the problem

#

depending on ur custom character u can do something else

zenith dew
#

hmmm okay
they're just humanoids rlly normal robloxians, no custom animations

#

or custom scripts

rich reef
#

ye then no need for

#

custom characters

#

just clothe the player character

zenith dew
#

alrighttt

#

how would i go about doing that? i saw a while ago there was a setting for custom clothing n all but i don't think that's what i want

rich reef
#

remove players shirt and clothing instances

#

then clone in ur own

#

thats it really

zenith dew
#

alright
i can change the brick colour of the player, right? and the face decal n all and add accessories?

#

hmmm but

#

wait

#

the custom characters are team specific

rich reef
#

yea

zenith dew
#

woulkd i still be able to do that?

rich reef
#

why not

#

if team a then shirt a

#

if team b then shirt b

zenith dew
#

okay

#

is this done through a script or nah?

rich reef
#

it is

#

done through a script yes

#

just clone and set parent

zenith dew
#

alright hmmm

#

okay thx i'll try that

#

so after that my issues should be fixed yeah?

rich reef
#

should be

zenith dew
#

alrighty thx dude for the help :>.

rich reef
#

yo welcome

deft horizon
#

dont think u need it now though

zenith dew
#

oh yedah i've seen breakpoints
i'm not exactly sure what they do though

deft horizon
#
fickle kettleBOT
#

studio** You are now Level 6! **studio

zenith dew
#

thx m8

#

i needed that

#

:>

#

yo okay for some reason my for loop isn't working idfk why

#
local Players = game:GetService("Players")
local InsertService = game:GetService("InsertService")

local function newPlayerModel(player)
    task.wait()
    local char = game.Players.LocalPlayer.Character
    
    player.CharacterAdded:Connect(function()
            for i,v in pairs(char:GetDescendants()) do
                if v:IsA("Accessory") or v:IsA("Decal") or v:IsA("Clothing") then
                    v:Destroy()
                end
            end
            
        task.wait(1)
        if player.Team.Name == "Illumina" then
            InsertService:LoadAsset(109334885793612).Parent = char -- Wings

        elseif player.Team.Name == "Darkheart" then

        end
    end)
end
#

just striahgt up isn't working