Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make a script COMPLETELY STOP?

Hey again, this is my 3rd question I've asked today lol, sorry about that!

My question is how to make a script completely stop, like not run again once i die. I have a loading screen thing going on and i really like it, but i dont want players to see the whole thing again once they die, so far i've tried:

script.parent.GamePopup:Destroy()

This hasnt worked, so then i tried:

script.Disabled = true

And that also didnt work, if you're wondering here is my script (there are no loops in it)

script.Parent.GamePopup.Background.Visible = true
script.Parent.GamePopup.Visible = true
script.Parent.GamePopup.Teleporting.Visible = true
script.Parent.GamePopup.Wait.Visible = true
script.Parent.GamePopup.Lib.Visible = true

local Tween = game:GetService("TweenService")
-- Content Variables

local Sidebar = script.Parent:WaitForChild("Sidebar")
local Title = Sidebar:WaitForChild("Logo")

local MenuOver = script.Parent:FindFirstChild("MenuOver")
MenuOver.Value = false
print(MenuOver.Value)



	--Game Popup
local GamePopup = script.Parent:WaitForChild("GamePopup")
local Background = GamePopup:WaitForChild("Background")
local Teleporting = GamePopup:WaitForChild("Teleporting")
local Wait = GamePopup:WaitForChild("Wait")
local Lib = GamePopup:WaitForChild("Lib")
--Camera
local Cam = game.Workspace.CurrentCamera
local CamPoints = workspace:WaitForChild("CameraPoints")



--Tweens
local SlideInSidebar = Tween:Create(Sidebar,TweenInfo.new(0.69, Enum.EasingStyle.Quad, Enum.EasingDirection.Out,0, false, 0),{Position = UDim2.new(0,0,0,0)})
local SlideOutSidebar = Tween:Create(Sidebar,TweenInfo.new(0.69, Enum.EasingStyle.Quad, Enum.EasingDirection.Out,0, false, 0),{Position = UDim2.new(-1,0,0,0)})



-- CLOSE BACKGROUND GUI
local images = {"http://www.roblox.com/asset/?id=4756555748", "http://www.roblox.com/asset/?id=4756556665", "http://www.roblox.com/asset/?id=4756563878","http://www.roblox.com/asset/?id=4756798215", "http://www.roblox.com/asset/?id=4756802332", "http://www.roblox.com/asset/?id=4756824289", "http://www.roblox.com/asset/?id=4756825065", "http://www.roblox.com/asset/?id=4756826088"}

wait(1)
print(images)
script.Parent.GamePopup.Background.Image = images[math.random(1, #images)]
wait(1)
print(images)
script.Parent.GamePopup.Background.Image = images[math.random(1, #images)]
wait(1)
print(images)
script.Parent.GamePopup.Background.Image = images[math.random(1, #images)]

--Hides Gamepopup
script.Parent.GamePopup.Background.Visible = false
script.Parent.GamePopup.Visible = false
script.Parent.GamePopup.Teleporting.Visible = false
script.Parent.GamePopup.Wait.Visible = false
script.Parent.GamePopup.Lib.Visible = false


Cam.CameraType = Enum.CameraType.Scriptable
Cam.FieldOfView = 90

--Plays the cutscene
SlideInSidebar:Play()
local function TweenCameraPos(Point, Speed)
	Tween:Create(Cam, TweenInfo.new(Speed, Enum.EasingStyle.Linear),{CFrame = Point.CFrame}):Play()
end

-- Plays Animation
	Cam.CFrame = CamPoints:FindFirstChild("1").CFrame
    TweenCameraPos(CamPoints:FindFirstChild("2"),4)
	wait(4)
	Cam.CFrame = CamPoints:FindFirstChild("3").CFrame
    TweenCameraPos(CamPoints:FindFirstChild("4"),4)
	wait(4)
	Cam.CFrame = CamPoints:FindFirstChild("5").CFrame
    TweenCameraPos(CamPoints:FindFirstChild("6"),4)
	wait(4)
	Cam.CFrame = CamPoints:FindFirstChild("7").CFrame
    TweenCameraPos(CamPoints:FindFirstChild("8"),4)
	wait(4)
	Cam.FieldOfView = 60
	game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
	game.Workspace.CurrentCamera.CameraType = "Custom"
	
	

SlideOutSidebar:Play()
script.Parent.GamePopup:Destroy()
script.Disabled = true

Anyway to make the script stop completely forever?

5 comments

0

Try script:Destroy() as it will destroy itself after it has done it's work...

0

nahh do break or return

0

Script:Destroy() can be the most convenient in my opinion as it just destroys the whole script..

0

break or return are not to use as they can still be ran and used.

0

bruh just use script.Disabled = true

2 answers

Hi, i assume that it's something like menu.. you can set the gui to not reset when character dies..

ScreenGui.ResetOnSpawn = false

You can change it without script in properties. Hope that helps.

You can use

script.Destroy()

or

script.Disabled = true

This discussion is preserved as it was. New answers, comments, and votes are closed.