This script is server sided and runs fully without errors or anything in console. When using PivotTo() in other scripts (with comparably similar code) it works fine. The character teleports to the car but the car doesn’t teleport to mp . Here is the code with some parts omitted. Just remember that no warnings or errors get outputted to console, and everything is triggered via proximityprompt. mp is a part.
local p = script.Parent.Torso.Prompt
local r = script.Parent.Head.Prompt
local cs = game.Workspace.Map.Buildings.CarShop.Placepart
local ss = game:GetService("ServerStorage"):WaitForChild("Cars")
local chs = game:GetService("Chat")
local guy = script.Parent
local function oporem()
local ya = cs:FindFirstChild("Open")
if ya then
return "Open"
else
return "Occupied"
end
end
-- proximityprompt trigger
if mp then
plr:WaitForChild("leaderstats").Cash.Value = plr:WaitForChild("leaderstats").Cash.Value - p.Cost.Value
guy.Torso.Audio:Play()
mp.Name = "Occupied"
local nc = workspace.Map.Misc.cars:FindFirstChild(plr.DisplayName.."'s car")
nc:PivotTo(mp:GetPivot())
local char = plr.Character or plr.CharacterAdded:Wait()
char:PivotTo(nc.DriveSeat.CFrame + Vector3.new(0, 1, 0))
wait(5)
mp.Name = "Open"
else
When you activate the proximity prompt, it’s supposed to teleport the car to mp and then teleport you to it. Instead, it just teleports the character to the car…
Yes but it all runs fine, if you want to see the whole thing then here it is
r.Triggered:Connect(function(plr)
if plr:WaitForChild("leaderstats").Cash.Value >= r.Cost.Value and workspace.Map.Misc.cars:FindFirstChild(plr.DisplayName.."'s car") then
local e = oporem()
local mp = cs:FindFirstChild(e)
if mp then
plr:WaitForChild("leaderstats").Cash.Value = plr:WaitForChild("leaderstats").Cash.Value - p.Cost.Value
guy.Torso.Audio:Play()
mp.Name = "Occupied"
local nc = workspace.Map.Misc.cars:FindFirstChild(plr.DisplayName.."'s car")
nc:PivotTo(mp:GetPivot())
local char = plr.Character or plr.CharacterAdded:Wait()
char:PivotTo(nc.DriveSeat.CFrame + Vector3.new(0, 1, 0))
wait(5)
mp.Name = "Open"
else
chs:Chat(p.Parent, "It seems no parking space is available for your car.", Enum.ChatColor.Red)
end
elseif not workspace.Map.Misc.cars:FindFirstChild(plr.DisplayName.."'s car") then
chs:Chat(p.Parent, "You do not have a car for me to locate.", Enum.ChatColor.Red)
elseif plr:WaitForChild("leaderstats").Cash.Value < r.Cost.Value then
chs:Chat(p.Parent, "You cannot afford this.", Enum.ChatColor.Green)
end
end)
I am not trying to be rude in saying this, but I did read the original, and considering I am the only one responding to your problem, it was most likely not very clear to anyone else.
As long as someone is trying to help you, don’t stress over having to repeat information if they ask, the end result is you might get this solved, so I would think that is worth it.