Hello people, I tried to make a teleporting script within the experiance by pressing a proximity prompt but somehow the whole script did not ran, my local script is here:
local Seat = script.Parent
local ProxiPromtService = game:GetService("ProximityPromptService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TeleportModult = require(ReplicatedStorage:WaitForChild("TeleportToSeat"))
local TeleportEvent = ReplicatedStorage:WaitForChild("Teleport")
local TeleportDestination = Seat.Position
local TeleportFaceAngle = 0
local FreezeCharacter = true
print("Script ran.")
local function Teleport()
print("Prompt is triggered.")
local Params = {
destination = TeleportDestination,
faceAngle = TeleportFaceAngle,
freeze = FreezeCharacter
}
TeleportEvent:fireServer(Params)
end
ProxiPromtService.Triggered:Connect(Teleport())
The output does not display any error or the printed lines, it is located under the object with the proximity prompt, I have tried to move it under the proximity prompt and to server script service but it did not yield the same result.
Did you try instead of Proximitypromptservice.Trigger your ProximityPrompt instance itself .Triggered
2 Likes
local Seat = script.Parent
local ProxiPromtService = game:GetService("ProximityPromptService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TeleportModult = require(ReplicatedStorage:WaitForChild("TeleportToSeat"))
local TeleportEvent = ReplicatedStorage:WaitForChild("Teleport")
local TeleportDestination = Seat.Position
local TeleportFaceAngle = 0
local FreezeCharacter = true
print("Script ran.")
local function Teleport()
print("Prompt is triggered.")
local Params = {
destination = TeleportDestination,
faceAngle = TeleportFaceAngle,
freeze = FreezeCharacter
}
TeleportEvent:fireServer(Params)
end
ProxiPromtService.Triggered:Connect(Teleport)
You dont have to do Teleport() when its in Connect so try
ProxiPromtService.Triggered:Connect(Teleport) instead
LocalScripts need to be in StarterPlayerScripts, StarterCharacterScripts, StarterGui, or a Tool to run. You’ll need to put it in one of those places and link it to the seat if possible.
I have put it in StarterCharacterScript and it printed out in the output.