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

{SOLVED BY ASKER} How do I make this script stop functioning after player reset?

I have two scripts changing the player's camera view:

script 1:

local pos=script.Parent.pos
local camera = workspace.CurrentCamera
repeat wait() until pos.Value~=nil
camera.CameraSubject = pos.Value
camera.CameraType = "Scriptable"
local angle = 5
--



while wait() do

    camera.CoordinateFrame = CFrame.new(pos.Value.Position) 
                           * CFrame.Angles(0, angle, 0) 
                           * CFrame.new(0, 0, 30)       
    angle = angle + math.rad(.5)
   if script.Value.Value == true then 
	break
end
end 

camera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
camera.CameraType = "Custom"
script.Parent:Destroy()
script.Disabled = true

script 2:

local pos = script.Parent.pos
local num=#(workspace.SpinLocations:GetChildren())
local cam = workspace.CurrentCamera
local lit = 1
while true do
	script.Parent.pos.Value=workspace.SpinLocations["cameraspin"..lit]
	if lit<num then
		lit=lit+1
	elseif lit>=num then
		lit=1
	end
	wait(2)
end

script.Disabled = true

I tried putting script.Disabled = true at the end of both scripts, but when I reset the script still functions.

How do I make my scripts not function after reset?

Any help is appreciated :)

1 comment

0

"{SOLVED BY ASKER}" Then you should answer your own question

1 answer

I'm not sure if this will work but try this. Also make sure it is a local script otherwise it won't work.

game.Players.LocalPlayer.Character.Humanoid.Died:Connect(function()
	script.Disabled = true
end)

If that doesn't work try looking at this DevForum:

https://devforum.roblox.com/t/script-disabled-true-but-its-still-running/267862/6

2 comments

0

Thank you for your time, but Unfortunately that doesn't work :/

0

Try making a variable that is set to true. The script can only function when the Boolean value is at true. At the end, make it false to disable it.

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