#My menu is appearing again when I die

1 messages · Page 1 of 1 (latest)

kind otter
#

I made a Menu but when I die again in-game, the Menu plays again. I've tried disabling resetonspawn but the script is outside the screengui and I can't figure it out how

#
local ts = game:GetService("TweenService")
local plr = game.Players.LocalPlayer
local char = plr.Character
local currentCamera = game.Workspace.CurrentCamera
local coolDown = "99999999999999999999999999"

currentCamera.CameraType = Enum.CameraType.Scriptable

local cameras = game.Workspace:WaitForChild("CameraMenu")

char.Humanoid.WalkSpeed = 0
char.Humanoid.JumpPower = 0

local MenuAsset = script.Parent:WaitForChild("MenuAsset")

local playButton = MenuAsset:WaitForChild("Play")
local customizeButton = MenuAsset:WaitForChild("Customize")
local settingsButton = MenuAsset:WaitForChild("Settings")
local updatesButton = MenuAsset:WaitForChild("Updates")

MenuAsset.Bf.BackgroundTransparency = 0

currentCamera.CameraType = Enum.CameraType.Scriptable
currentCamera.CFrame = cameras:WaitForChild("Startpos").CFrame

task.wait(2)

ts:Create(MenuAsset.Bf,TweenInfo.new(1),{BackgroundTransparency = 0.3}):Play()
ts:Create(currentCamera,TweenInfo.new(4.2),{CFrame = cameras.Endpos.CFrame}):Play()    

task.wait(2.7)

for i,v in  MenuAsset:GetChildren() do 
    
    if v:IsA("ImageButton") then 
        ts:Create(v,TweenInfo.new(0.7),{ImageTransparency = 0}):Play()
    end
    
    if v:IsA("ImageLabel") then 
        ts:Create(v,TweenInfo.new(0.7),{ImageTransparency = 0}):Play()
    end
end

playButton.MouseButton1Click:Connect(function()
    ts:Create(MenuAsset.Play,TweenInfo.new(1),{ImageTransparency = 1}):Play()
    ts:Create(MenuAsset.Customize,TweenInfo.new(1),{ImageTransparency = 1}):Play()
wild bison
#

Is the script that enables the menu inside startercharacterscripts?

copper sandalBOT
#

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

kind otter
#
    ts:Create(MenuAsset.Settings,TweenInfo.new(1),{ImageTransparency = 1}):Play()
    ts:Create(MenuAsset.Updates,TweenInfo.new(1),{ImageTransparency = 1}):Play()
    ts:Create(MenuAsset.Title,TweenInfo.new(1),{ImageTransparency = 1}):Play()
    ts:Create(MenuAsset.Title2,TweenInfo.new(1),{ImageTransparency = 1}):Play()
    ts:Create(MenuAsset.Bf,TweenInfo.new(1),{BackgroundTransparency = 0}):Play()
    task.wait(1)
    ts:Create(MenuAsset.Bf,TweenInfo.new(1),{BackgroundTransparency = 1}):Play()
    char.HumanoidRootPart.CFrame = game.Workspace.afterMenuPos.CFrame
    char.Humanoid.WalkSpeed = 16
    char.Humanoid.JumpPower = 50
    currentCamera.CameraType = Enum.CameraType.Custom
    task.wait(coolDown)
end)
kind otter
#

I just made the menu with my limited knowledge since I've been only in roblox studio for a week now so

copper sandalBOT
#

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

wild bison
#

Hmm if you have ResetOnSpawn enabled then I don’t see why you would have this problem your code seems fine

kind otter
#

I also tried disabling the script after they hit play but it also doesn't work

#

so I just removed it

#

the script and the screen gui

kind otter
#
local plr = game.Players.LocalPlayer
local char = plr.Character

if char.Humanoid.Health == 0 then
    script.Parent.menuHandler.Enabled = false
end
char.Humanoid.Died:Connect(function()
    script.Parent.menuHandler.Enabled = false
end)
#

I made it so if the player dies the menu script will disable

#

but still even countless reset it still doesn't work

wild bison
#

I feel like within this context it’d probably be better to parent the scripts to your guis every time you respawn the scripts are running again as they are cloned to your players scripts

kind otter
#

I'll try to recreate the script and put it within the MenuAsset

wild bison
#

Yea I’m almost positive that will fix your issue

kind otter
#

I mean I knew that but

#

ngl

#

it's pain in the ascs to work on

#

YO

wild bison
#

Valid but it should be a pretty simple fix all your are doing is changing how the guis are accessed local gui = script.BlahBlah

kind otter
#

I fixed it

#

all I added was .Parent

wild bison
#

Amazing.

kind otter
#

LOLL

#

I figured it out

#

thanks for the help tho

wild bison
#

Np I’m glad you figured it out

kind otter
#

it wasn't working yesterday so I gave up

#

but then I looked at it again

#

and added this

wild bison
#

It be like that once you have a fresh perspective you realize how simple what you needed to do actually was

#

It just gets frustrating once you start having trouble and your tired and you just wanna be done

kind otter
#

I thought I couldn't do that but then I tried then it works fine

kind otter
wild bison
#

Yea I actually forgot to include that in my line gui = script.Parent.blahblah

kind otter
#

are you also making a game?

wild bison
#

I wouldn’t say making right now I’m kinda just in the process of learning until I eventually settle on a game to make

#

I just make concepts/frameworks for practice

kind otter
#

how long have you been learning?

wild bison
#

I mean I’ve been scripting for years now but not actively just something I recently started to seriously get into

copper sandalBOT
#

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

wild bison
#

So maybe like 3 months of scripting knowledge or sum

kind otter
#

I see, check dm

hidden oxide
#

I have the same problem and I'm very frustrated

#

I can't get the guis to not reactivate when I die

kind otter
#

ohh

#

yea I fixed it

#

but I forgot how

hidden oxide
#

xD

kind otter
#

lemme think

#

lemme recall

#

oh

#

what I did is I fixed the script

#

I added ".Parent" to a line

#

and it was fixed

#

may I see your script

copper sandalBOT
#

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

hidden oxide
#

HAHAHA I'm going to go crazy, I swear.

copper sandalBOT
#

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

kind otter
#

lemme see it

hidden oxide
#

I just solved it

kind otter
#

oh really

#

nice

hidden oxide
#

I was trying with gpt chat for maybe 3 hours and it didn't solve it for me.

kind otter
#

you just have to understand what you're doing and you're good

hidden oxide
#

It was this setting

kind otter
#

oh

hidden oxide
#

xD

kind otter
#

yea that works too

hidden oxide
#

:/

#

3 hours or more

#

to this

kind otter
#

so your script was inside the screenGui I suppose

hidden oxide
#

no, in StarterPlayerScripts

#

But the guis of menu, are inside of ScreenGUI

kind otter
#

yea

kind otter
#

I assume it is

#

mine was outside so that didn't work on me

hidden oxide
#

The problem with my script is that it is split

kind otter
#

ohh I see

#

may I see the menu

hidden oxide
#

I have a main menu and a cinematic that is skipped with a button.

kind otter
#

ahh I see

#

well then goodluck

hidden oxide
#

The button part of the cinematic is in StarterPlayerScripts but the rest of the gui is in StarterGui

kind otter
#

oh yea