This script opens a camera view of a place in the game, and stays that way until a button is pressed, which returns it to the normal camera. However, I want the gui to only show up once, so resetonspawn is off. However, this script still changes the view, so how do I stop the script from running after the first button press? I have tried script.parent.localscript:destroy() and script.parent.localscript.disabled = true.
wait(1); -- Wait for the camera to load
local Camera = workspace.CurrentCamera;
Camera.CameraType = Enum.CameraType.Scriptable;
Camera.CFrame = workspace.CameraPos.CFrame;
game.Workspace.Futuristic:Play()
local Player = game.Players.LocalPlayer;
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Enabled = false;
wait(0.1);
local StarterGui = game:GetService("StarterGui")
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, true)
workspace.CurrentCamera.Blur.Enabled = false
Camera.CameraSubject = Player.Character.Humanoid;
Camera.CameraType = Enum.CameraType.Custom;
Camera.CFrame = Player.Character.Head.CFrame;
game:GetService('Players').LocalPlayer:WaitForChild('PlayerGui'):SetTopbarTransparency(0)
game.Players.LocalPlayer.PlayerGui.NewButtonSelection.Enabled = true;
game.Workspace.Futuristic:Stop()
script.Parent.LocalScript.Disabled = true
end)
Yes there is a Disabled Property, but it is bad practice to disabled a script running in game, just what I’ve heard. (Can cause weird things to happen)