#Why does my door stop responding after an ingame event?

1 messages · Page 1 of 1 (latest)

steady haven
#

door script

vestal zephyr
steady haven
#
    local quickplr
for i,v in game.Players:GetPlayers() do
    quickplr = v
end 
if quickplr.Character.Hidden.Value == true then
    if workspace.IsLapLeading.Value == true then
        game.ServerScriptService.Main.Laps.Value += 1
script.Parent.Parent.Button.Script.Enabled = true
workspace.IsLapLeading.Value = false
workspace.Lock:Play()
if script.Parent.Parent.Button.Uses.Value < 1 then
local random = workspace.Garden:GetChildren()[math.random(1, #workspace.Garden:GetChildren())]
quickplr.Character:PivotTo(random.TP.CFrame)
game.ServerScriptService.Main.ToDo.Value = math.random(1,5)
workspace.Rooms.Value += 1
game.ServerScriptService.Main.Laps.Value = 0
workspace.CurrentDoor.Value = random.Door
                workspace.TPguide.Value = random.TP    
                workspace.Break125.Value = false
end
end
end

end)``` lua
steady haven
#

btw the collision is for player collision

vestal zephyr
#

so whats the problem

steady haven
#

have you seen the video

steady haven
vestal zephyr
#

i dont know whats the problem yet

#

looks ok to me

spiral plank
#

same

steady haven
#

at the end its supposed to bring me to an room

#

but the script is fine but for some reason it doesnt input nor works

#

when i clicked the button and then the door

vestal zephyr
#

do you use remoteevents or bindableevents?

steady haven
#

i made it so if everyone gathers near the door they go to the next room

#

by using magnitude

#

and event

vestal zephyr
#

see if that works

vestal zephyr
#

tbh idk what to do

#

might ask gemini

#

its helpful sometimes

steady haven
floral condorBOT
#

studio** You are now Level 5! **studio

steady haven
#

whatever

brave pebble
#

learn how to script

steady haven
#

the script is right above the chat

#

🥀

versed bane
versed bane
#

what class is the TPguide instance?

steady haven
steady haven
versed bane
spiral plank
#

it is so useful

#

i mean

#

there is attributes too

#

attributes are more fast

versed bane
#

bro i just assumed it didnt because i wanted something like it and some dude on roblox forum said it wasn't a thing </3

steady haven
#

js help bro

#

js let me finish bro

spiral plank
steady haven
spiral plank
#

if you could atleast make space between lines

versed bane
steady haven
#

also the dark room is an break room

#

the button does not do anything

#

players must gather to the door now

#

and also yes

#

thats whats im trying to do

steady haven
versed bane
spiral plank
steady haven
#
    
    local quickplr
    
for i,v in game.Players:GetPlayers() do
    
    quickplr = v
    
end 

if quickplr.Character.Hidden.Value == true then

workspace.IsLapLeading.Value = false

workspace.Lock:Play()

local random = workspace.Garden:GetChildren()[math.random(1, #workspace.Garden:GetChildren())]

quickplr.Character:PivotTo(random.TP.CFrame)

game.ServerScriptService.Main.ToDo.Value = math.random(1,5)

workspace.Rooms.Value += 1

game.ServerScriptService.Main.Laps.Value = 0

workspace.CurrentDoor.Value = random.Door

                workspace.TPguide.Value = random.TP     
                
                workspace.Break125.Value = false


end

end)```
#

for mr skid

spiral plank
#

and

steady haven
spiral plank
#

use this for sending codes

steady haven
#

i dont want my games to look soulless

#
    
    local quickplr
    
for i,v in game.Players:GetPlayers() do
    
    quickplr = v
    
end 

if quickplr.Character.Hidden.Value == true then

workspace.IsLapLeading.Value = false

workspace.Lock:Play()

local random = workspace.Garden:GetChildren()[math.random(1, #workspace.Garden:GetChildren())]

quickplr.Character:PivotTo(random.TP.CFrame)

game.ServerScriptService.Main.ToDo.Value = math.random(1,5)

workspace.Rooms.Value += 1

game.ServerScriptService.Main.Laps.Value = 0

workspace.CurrentDoor.Value = random.Door

                workspace.TPguide.Value = random.TP     
                
                workspace.Break125.Value = false


end

end)```
spiral plank
versed bane
steady haven
spiral plank
steady haven
#

oh

spiral plank
#

let me see waht is wrong there

#

it works on the first time right?

steady haven
#

youre talking about the rooms before the break room?

spiral plank
steady haven
#

the dark room is an break room.

#

every room before the dark room should have the lap system

versed bane
#

so the dark room is the blue or grey

spiral plank
steady haven
steady haven
spiral plank
#

is there any errors on the output?

versed bane
steady haven
#

the code is OK but the is no outputs

spiral plank
#

on this line

#

try to print something

steady haven
#

oh

spiral plank
#

we need to find what is wrong first

#

anddd

#

before the if check

#

try to print the hidden value

#

to see if for some reason it is false

#

because the sound does not play on the dark room

steady haven
#

doesnt print anything

spiral plank
#

add this print

#

and see what it prints

#

when you are on the

#

dark room

#

and try to open the door

steady haven
#

for some reason it says false

spiral plank
#

the value is false

#

is there another script

#

that you set the hidden value to true/false?

versed bane
spiral plank
#

because on this one

steady haven
spiral plank
#

you didnt set anything

steady haven
#

wait what

spiral plank
steady haven
#
game:GetService("RunService").Heartbeat:Connect(function()
    local you = game.Players.LocalPlayer.Character.Torso
local door = workspace.CurrentDoor
local pos = you.Position
local posdoor = door.Value.Position
local magnitude = (pos - posdoor).Magnitude --distance between the two parts
    magnitude= magnitude
    if magnitude < 11.1 then
        game.ReplicatedStorage.Safe:FireServer(script.Parent.Hidden.Value)
    else
        game.ReplicatedStorage.Exit:FireServer(script.Parent.Hidden.Value)
    end

end)
spiral plank
#

not wait

#

wait is deprecated

steady haven
#

what does task.wait do

spiral plank
#

the same wait does

#

but faster

#

wait can fail

steady haven
#

ok

#

interesting

spiral plank
#

task.wait is pro wait is noob

steady haven
#

im stuck on 2022 vro

#

ok so

floral condorBOT
#

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

steady haven
#

i think i know why it doesnt work

#

i havent set the currentdoor value and tp to the break room door

#

therefore the magnitude catches the previous door instead of the new one

#

so problem resolved

#

ty

spiral plank
#

good thing you find it

#

nice

#

also pls try to make your code more readable 😭

steady haven
spiral plank
spiral plank
#

dont do all that to get the player if you already know who it is

steady haven
steady haven
spiral plank
#

i think this would even break if there was 2+ players

spiral plank
#

return returns something

#

😱

#

and like

steady haven
#

im not used for modules

spiral plank
#

parameter returns something

#

like

#

the parameter of the MouseClick event

#

that you used

#

on the script

#

is the player that clicked

steady haven
#

ee?

spiral plank
#

so the parameter returns the player that clicked

spiral plank
steady haven
#

ohhh

spiral plank
#

ee would be the player that clicked

#

so you wouldnt need to make the for loop to get the player

steady haven
#

oh

spiral plank
#

and when u click

#

inside the parameters

#

it will explain what it returns

#

here you can see it returns the player who clicked

#

and then you can get the player easily

#

you maybe need to take a look on how it works because it is very important

#

not for only modules