Hey there!
I have a local script that plays a cutscene every time a player joins, but I haven’t been able to get the cutscene to skip. I feel like it would use a remote event, but I’m not sure how, since the cut scene is handled in a local script, as I said. The script is in a text button, in a screengui in startergui. Here’s the code:
local TweenService = game:GetService("TweenService")
local camera = workspace.Camera
local sound = script.Sound
function tween (part1, part2, cutsceneTime)
local TweenInfo = TweenInfo.new(
cutsceneTime,
Enum.EasingStyle.Sine,
Enum.EasingDirection.InOut,
0,
false,
0
)
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = part1.CFrame
local tween = TweenService:Create(camera, TweenInfo, {CFrame = part2.CFrame})
tween:Play()
wait(cutsceneTime)
camera.CameraType = Enum.CameraType.Custom
end
wait(2)
sound:Play()
tween(game.Workspace.Camera1, game.Workspace.Camera2, 5)
camera.CameraType = Enum.CameraType.Fixed
wait(30)
camera.CameraType = Enum.CameraType.Scriptable
sound:Stop()
tween(game.Workspace.Camera2, game.Workspace.Camera3, 5)
camera.CameraType = Enum.CameraType.Fixed
wait(10)
camera.CameraType = Enum.CameraType.Custom
I’ve heard that it’s bad practice. I’ve also heard that a script can’t disable itself. It must be disabled by a different script that isn’t the child of the script being disabled.
I’ve tried disabling scripts and it just doesn’t work well, especially since it can’t disable itself.
A script can disable itself. I use that a lot in many scripts I do. However, a local script, even if disabled, won’t do anything unless a remote event is used to tell the server.
Right. I actually just encountered that. I got it to work, but I’m going to make sure it doesn’t disable the script for all players, even those who join after it’s clicked. It shouldn’t, but better safe than sorry.
Use corountine to do this, you could disable the script however it isn’t good practice as @dodle120 said.
Here is a post to help with understanding corountine
corountine.yield() will help pause the function of your cutscene and you should be able to fix the player’s camera after you yield the cutscene function.