I can’t figure out why the following teleporting code works as expected in Studio, but does nothing in the published game:
function module.promptTriggeredActions(promptObject, player)
if promptObject.Parent.Parent.Name == "TeleportBench_1" then
player.Character.Humanoid.RootPart.CFrame = workspace.Building_1.Spawn.CFrame
elseif promptObject.Parent.Parent.Name == "TeleportBench_2" then
player.Character.Humanoid.RootPart.CFrame = workspace.Building_2.Spawn.CFrame
elseif promptObject.Parent.Parent.Name == "TeleportBench_3" then
player.Character.Humanoid.RootPart.CFrame = workspace.Building_3.Spawn.CFrame
elseif promptObject.Parent.Parent.Name == "TeleportBench_4" then
player.Character.Humanoid.RootPart.CFrame = workspace.Building_4.Spawn.CFrame
else
local toolName = promptObject.Parent.Parent.Name
WeaponUpgrades.upgradeTool(player, toolName)
promptObject.Enabled = false
end
end
You can find all the code on Github as well: