Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I make my local script disabled with a button?

Asked by 3 years ago

I've made a local script that plays a cutscene when a player starts the game, the camera stays in the same position at the end. But I want to make a button that returns to the player's default camera position. how can I do this? I've tried disabling the local script won't it won't work.

Here is the cutscene local script:

local TweenService = game:GetService("TweenService") local camera = game.Workspace.Camera local PlayButton = script.Parent local cutsceneTime = 3 --this will change the length of your cutscene in seconds local tweenInfo = TweenInfo.new( cutsceneTime, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0 )

local function tween(part1,part2) camera.CameraType = Enum.CameraType.Scriptable camera.CFrame = part1.CFrame

local tween = TweenService:Create(camera, tweenInfo, {CFrame = part2.CFrame}) tween:Play()

PlayButton.MouseButton1Click:Connect(function()

    camera.CameraType = Enum.CameraType.Custom
end)        

end

wait()

tween(Workspace.Test1, Workspace.Test2)

0
The first one to answer the question correctly will get a custom free model from me, it has to be used for Roblox though. Roblox28721 10 — 3y
0
Instead of disabling the local script why don't you just set the camera type back to what it originally is in your game. cmgtotalyawesome 1418 — 3y
0
how do I do that Roblox28721 10 — 3y

Answer this question