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

Player is unable to move on respawn?

Asked by
Oxprem 140
3 years ago

Howdy! I am making a cutscene. The cutscene is working well, it teleports the player to the spawn and all, but whenever the player dies and respawns, they are unable to move. I am not sure why this is happening. Heres the script:

local TweenService = game:GetService("TweenService")
local Camera = game.Workspace.Camera
local plr = game.Players.LocalPlayer
local char = plr.Character
local hum = char:WaitForChild("Humanoid")

function tween(part1, part2, cutsceneTime)
    local tweeninfo = TweenInfo.new(
        cutsceneTime,
        Enum.EasingStyle.Sine,
        Enum.EasingDirection.Out,
        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

game.ReplicatedStorage.Cutscene.OnClientEvent:Connect(function()
    char:MoveTo(game.Workspace.PlayerCutsceneTeleporter.Position)
    local PlayerModule = require(plr.PlayerScripts.PlayerModule)
    local Controls = PlayerModule:GetControls()
    Controls:Disable()
    tween(Camera, game.Workspace.CameraPart, 3)
    --hum:Move(game.Workspace.PlayerCutscenePart.Position, false)
    plr:Move(Vector3.new(0, 0, -1), true)
    tween(game.Workspace.CameraPart, game.Workspace.CameraPart2, 3)
    tween(game.Workspace.CameraPart2, game.Workspace.CameraPart3, 3)
    tween(game.Workspace.CameraPart3, game.Workspace.CameraPart4, 2)
    Controls:Enable()
end)

NOTE: This is a local script inside of StarterGui. No, its not inside of any GUIs, in case you were wondering. If you need any more information, let me know, as this is my first question.

0
I'm wondering if you should disable reset? nasyplay 0 — 3y
0
How would I do that? Oxprem 140 — 3y

Answer this question