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

teleport player from one part (waiting 10s) then to another part?

Asked by 3 years ago

So i have a cutscene in my game triggered by a part touch. in order for the cutscene to work the player needs to be teleported to one block where he/she is seated then in 10 seconds teleported to block 3. As well as having the player anchored during the cutscene so he/she cant jump around which is very hard given the seat and teleport pads.

function onTouch(part)
if part.Parent.Humanoid ~=nil then
        part.Parent:MoveTo(script.Parent.Parent.Tele2.Position)
    end
end
script.Parent.Touched:connect(onTouch)``````
  • is what i have on teleport pad 1*
function onTouch(part)
    if part.Parent.Humanoid ~=nil then
        wait(10)
part.Parent:MoveTo(script.Parent.Parent.Tele3.Position)
script.Parent.Parent.Tele3.Script.Disabled = false 
wait(0)
script.Parent.Parent.Tele3.Script.Disabled = false
end
end
script.Parent.Touched:connect(onTouch)

is what i have on teleport pad 2

function onTouch(hit)
        local player = hit.Parent:WaitForChild("HumanoidRootPart")
    if player then
        wait(.1)
        player.Anchored = true
        wait(10)
        player.Anchored = false
        end
    end
    script.Parent.Touched:Connect(onTouch)

is what i also have on teleport pad 1 to anchor the player and then un-anchor. I think it would be easier if teleport pad 2 didnt have a script and instead teleport pad just had a wait(!0) after the first teleport to the second but i cant figure it out. Any help or solutions would be greatly appreciated!

1 answer

Log in to vote
0
Answered by
Oxprem 140
3 years ago

Instead of having the Player Anchored, I recommend disabling the player's Controls, like this:

local PlayerModule = require(plr.PlayerScripts.PlayerModule)
local Controls = PlayerModule:GetControls()
Controls:Disable()

And in case you want to Enable these Controls, just write this:

Controls:Enable()

I should mention that plr is the player that you want to have their Controls disabled, so change that to however you are defining the player. Also, this doesn't anchor your player or anything, just simply makes them unable to Control it, which allows you to move the character freely.

0
that makes sense thanks TheBlurryKnight 10 — 3y
0
No Problem Oxprem 140 — 3y
Ad

Answer this question