How to make a script stop running after the button is pressed?

If none of those work then try to disconnect the connection like this:

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;
local playerConnect --initialization

local function ClickedMouse()
	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
	playerConnect:Disconnect() --Disconnects this function from MouseButton1Click
end

playerConnect = script.Parent.MouseButton1Click:Connect(ClickedMouse) --Used to Disconnect later on

It is actually in startergui, not starterplayerscripts.

That will not help, the scripts is remade every time it is re spawned.

Why is it in StarterGui? Is it under a ScreenUI?

I would recommend placing it in ScreenGui with ResetOnSpawn set to false

I’m stupid, there is another script that also controls the camera that I need to destroy. Sorry for wasting time.

No problem lol. We all make mistakes! :smile:

It’s ok just like the person said above we all make mistakes :slight_smile:

Ok but why a semicolon at the end of wait(1) this isn’t C++ or anything or im just being stupid I just realized that

I copied and pasted Ryanthemudkip’s code, you’ll need to ask him about the end of line character :thinking:.

It’s just kinda like a signature for me, It doesn’t really do anything :slight_smile:

Oh ok I’m just thinking that it will give an error in the output once you run it