#Flashing Black Screen When Respawning

1 messages · Page 1 of 1 (latest)

teal timber
#

In my obby whenever I die/respawn the game starts respawning me constantly while the screen flashes black, after about a minute or two it stops and it finally respawns me properly. Weird part is when I play on the account that owns the game it doesnt happen, but when I play on an alt account it does happen. Any help is greatly appreciated

shadow tulip
#

also is this ai, i can't tell

#

the comments and making a remote event with instance.new is throwing me off

serene quest
teal timber
#

And it didn't help

teal timber
teal timber
serene quest
latent meteor
#

@teal timber if you want I can sit down with you and teach you the basic concepts of this but I need to see more specifically the local script that's firing the remote

teal timber
#

just does that

#

for ages

#

then sometimes it fixes after a minute or two

#

and then if you die again it keeps happening

shadow tulip
#

you have like 20 of the same script that has player.CharacterAdded which runs when a player respawns/joins the game for the first time

#

all does the same thing

teal timber
#

do I not need it in every checkpoint tho?

shadow tulip
#

you can do all that in one main script

teal timber
#

seriously?

torpid summitBOT
#

studio** You are now Level 1! **studio

teal timber
#

this is what I have rn

shadow tulip
#

just put all the checkpoints under a folder in workspace

teal timber
#

done that

shadow tulip
#

then loop through it and connect the touch event from there

teal timber
#

right

#

so how would I do that exactly...?

shadow tulip
#

let me write a concept

teal timber
#

alr ty

shadow tulip
#
local PlayerService = game:GetService("Players")

local checkpoints = workspace.CheckPointsFolder

function SetCheckpoints()
    for index, value in checkpoints:GetChildren() do
        value.Touched:Connect(function(basePart)
            if basePart.Parent:FindFirstChild("Humanoid") then

                local character = basePart.Parent
                local player    = PlayerService:GetPlayerFromCharacter(character)

                local CheckPosition = value:GetAttribute("Checkpoint") -- Vector3 Value

                player:SetAttribute("Checkpoint", CheckPosition)
            end
        end)
    end
end

PlayerService.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        if player:GetAttribute("Checkpoint") then
            character:PivotTo(CFrame.new(player:GetAttribute("Checkpoint"))) -- Position Player
        end
    end)
end)

SetCheckpoints()
#

probably what i would of done

#

just a rough sketch

teal timber
#

and I'd just make a new script in serverscriptservice and it'd just work?

#

or do I still need the script in checkpoints

shadow tulip
#

you don't need a script under every checkpoint part

#

that is bad practice

#

this script will not work if you copy and paste it

#

it's for you to understand how to manage things in 1 main script

#

or a few main scripts

teal timber
#

yeah but i mean i dont need any scripts at all

#

in the checkpoints?

shadow tulip
#

no

teal timber
#

alr

#

sorry i sound dumb

#

im new to all this

shadow tulip
#

it's fine

#

it's a common thing most people do as beginners

teal timber
#

alrighty

#

also i know this is gonna sound really stupid of me

#

but im getting these scammy popups and I went through all my scripts, models and plugins and i just cant find anything thats causing it

#

like genuinely

#

im so lost

#

i've went through all the models n everything

#

checked for "prompt"

#

"marketplace"

#

in search

#

removed all my plugins

#

still getting stuff like this tho

shadow tulip
#

check free model scripts

#

i never used it but i know people can use something call loadstring

#

which can run code that isn't written inside the game

teal timber
#

yeah i checked for that already but nothing

torpid summitBOT
#

studio** You are now Level 2! **studio

teal timber
#

just so confused

shadow tulip
#

usually you want to avoid free models

teal timber
#

yeah i barely used any

shadow tulip
#

but if you have to use one, any scripts under the model you can delete

#

it will never spawn outside of model

teal timber
#

alr

#

so

#

go through all the models

#

and double check

#

basically

shadow tulip
#

pretty much

#

another way to tell if it's your plugins is make a new experience and see if the problem persists

teal timber
#

either way I deleted all my plugins

#

because i wasnt using them

#

im gonna make a script first anyway

teal timber
shadow tulip
teal timber
#

sigh okay

#

what should I be looking for

#

just loadstring, prompt, marketplace

shadow tulip
#

anything you didn't make

#

mostly scripts

#

just search for local scripts/server scripts

teal timber
#

yeah i have 299 matches

#

im looking through them

#

but like keywords would be

#

loadstring, prompt, marketplace

shadow tulip
#

299 server scripts?

teal timber
#

kill bricks and stuff

shadow tulip
#

wow

#

that is wild

teal timber
#

is it

#

mostly stuff like this

#

in parts

#

should I just go through the whole obby and delete scripts and do it through properties

#

like kills bricks and transparency and stuff

shadow tulip
#

note this can all be accomplish in one script with multiple modules

teal timber
#

oh yikes

shadow tulip
#

i have a folder with 50 parts and this one script makes them damage bricks

teal timber
#

so I could've just put kill bricks in one folder and then done a script

shadow tulip
#

yea

teal timber
#

you know

#

that makes a lot more sense

shadow tulip
#

studio uses your resources

#

so if your pc is good having 300 scripts would be doable

teal timber
#

I have a 3060 and a ryzen 5600

#

so

#

decently good

shadow tulip
#

but in real servers game uses, if i remember a single core intel xeon cpu

#

and 4 - 6 gbs of ram give or take depending on players

#

insane lag and insane throttling

teal timber
#

so then it'd make my game really laggy on lower end devices

#

i get it

#

wow im silly

shadow tulip
#

it's fine

teal timber
#

so what i need to do is delete all the scripts, make one big one for kill bricks and stuff

shadow tulip
#

no need to say that

#

we all feel dumb in the pursuit for knowledge

#

everyone been there

teal timber
#

you're smart

shadow tulip
#

also if you haven't use modules

teal timber
#

modules?

shadow tulip
#

module scripts

#

it's like a table you can call (require) and it stores and runs code

#

so i have 2 main scripts and a ton of modules with each chunk of code depending on what i need

teal timber
#

ohhhh i think i get it

torpid summitBOT
#

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

teal timber
#

so its just easier to tell whats wherre

#

instead of one huge block of code

shadow tulip
#

easier to maintain

teal timber
#

yesyes

shadow tulip
#

one of my main script

#

most of the logic is within the modules

#

the main script is just to connect the events and connections

teal timber
#

I see

#

this is very technical

shadow tulip
#

note i may not be best scripter according to this server skill level

#

this is just the best way i can help you, and the best i know of soo far

teal timber
#

i mean you seem pretty skilled to me

shadow tulip
#

i'm skilled enough to fix the problems i create so i suppose

#

but you'll get there eventually

#

only a matter of time

teal timber
#

hopefully

#

okay so

#

for the checkpoints

#

I have it so that it plays a sound every time its touched, i removed the script that makes it play but kept the sound in the checkpoints, do I keep the sound in the checkpoints

#

or do i delete it and keep one in workspace

#

or a folder or something

shadow tulip
#

i see no problem with having a sound object under every checkpoint

teal timber
#

that wont cause lag then?

shadow tulip
#

you can just checkpoint:FindFirstChild("sound") and play it

teal timber
#

yeah I have that or something similar in my script anyway

#

like i deleted the scripts in the checkpoints themselves

#

and made one big script

shadow tulip
#

if it's under 500 i see no issue

#

considering it's an obby, not much parts

teal timber
#

but if it was a bigger game

#

then how would I do it

#

a folder in workspace

#

or

#

replicated storage

#

or what

shadow tulip
#

if it was a big game

#

you'd play the sound client side

#

and let the server detect which players are within range to hear the sound and fire to those clients

teal timber
#

okay i guess that makes sense

shadow tulip
#

you'd load all the sound ids in a module script with it's logic

#

and have one sound object within the player's character

#

and you'd just configure that one sound object or maybe 5 at a time to play whatever sounds you need

teal timber
#

hrm

#

okay

#

i think i get it

shadow tulip
#

it's quite easy for your game to be unoptimized in roblox

#

especially if you're planning to cater to mobile users

teal timber
#

yeah i'd imagine so

#

i have another question

#

so for this

#

how would I make a script

#

for it

#

if i moved all the kill bricks to one folder

#

and called it just something like "killbrick"

shadow tulip
#

use a for loop

#
for index, brick in brickFolder:GetChildren() do
    brick.Touched:Connect(function()
      --damage logic
  end)
end
teal timber
#

and where would I put the name "killbrick"

#

or would i do that at all

#

im assuming it needs the name

#

of the folder like

shadow tulip
#

yea just name a folder called killbricks or something

#

and index it and use :GetChildren()

teal timber
#

and put it in the brackets

torpid summitBOT
#

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

teal timber
#

or am i tweaking

#

and then i put

shadow tulip
#

i suck at explaining

teal timber
#

script.Parent.Touched:connect(function(hit)
if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid.Health = 0
end
end)

shadow tulip
#

the script will be under serverscriptservice

teal timber
#

so i'd change it

#

to

shadow tulip
#

it seems you don't know what for loops do

teal timber
#

not really

#

sounds like an eldritch language honestly

shadow tulip
#

hear me out

teal timber
#

didnt realize making an obby would be so technical

shadow tulip
#

watch this guy beginner playlist

#

giving you basic knowledge and fundamentals in scripting

#

building an obby is easy

#

scripting it is a different story

teal timber
#

seems so

#

i thought i'd just learn as i went honestly

shadow tulip
#

i respect the blind playthrough

#

but i recommend watching brawldev, researching your problems from the dev forum (i assure you the problems you have someone already asked) and reading up on roblox api

#

aka their official wiki for roblox studio explaining every nook and cranny

teal timber
#

Alright I'll give them a look

#

ty for ur help

shadow tulip
#

np

teal timber
#

i'll try fix my buggy little game

shadow tulip
teal timber
#

I have one last question

#

sorry

#

after i make the loop

#

wait no

#

i figured it out i think

#

'all good

teal timber
#

quick question

#

is there a reason this isnt working?

#

I changed it to if part IsA("Part")

#

but it still doesnt work

shadow tulip
#

it's most likely erroring at line 6

teal timber
shadow tulip
#

well it can't find the folder

#

at line 1

teal timber
#

wait i think

#

hang on

shadow tulip
#

also hit inside the touch event can touch other parts

teal timber
#

okay i fixed

shadow tulip
#

ah nvm

#

i overthinked it

#

i read it wrong

teal timber
#

the issue was that i accidentally had it in terrain

#

instead of workplace

#

space

#

whoopsies

shadow tulip
#

i see

teal timber
#

atleast i wont make that mistake again

#

sorry I'm like really really new to this

#

bare with me

#

also

#

"part" would be better to use than "basepart"

#

because its a broader term

#

right?

shadow tulip
#

i put basePart cause that's what i'm looking for

#

it doesn't really matter

#

roblox have otherPart i believe

teal timber
#

ah alr

#

ty