I have a door script that plays a cutsence when the proximityPrompt is triggerd, but the problem is I dont know how to teleport the player on the otherside. I want to achieve this by moving the player character 5 studs on the other side of the door. My best guess was to use the players’s HRP lookvector, yet I couldnt figure that out, and thats flawed.
an image for refrence
local cutscene = require(script.Parent.Cutscene)
local door = {}
function door.new(model: Model)
local self = setmetatable({}, {__index = door})
self.proximityPrompt = Instance.fromExisting(script.Prompt)
self.model = model
return self
end
function door:Initilize()
self.proximityPrompt.Parent = self.model
self.proximityPrompt.TriggerEnded:Connect(function(player:Player)
self.proximityPrompt.Enabled = false
local newCutscene = cutscene.new()
for _,v in pairs(player.Character:GetChildren()) do
pcall(function() v.Anchored = true end)
end
newCutscene:Play(function() -- callbackfunction
player.HumanoidRootPart.Postition = --teleport code here
for _,v in pairs(player.Character:GetChildren()) do
pcall(function() v.Anchored = false end)
end
task.delay(4, function() self.proximityPrompt.Enabled = true end) --debounce
end)
end)
end
return door
the door script (uses collection service, the doors are tagged)
also want to point out I dont want to have to create 2 parts to teleport from each side of the door, that would be a hassle to implment.