I am working on a project that when a user touches the back door a of a vehicle they get welded to the vehicles floor so the driver can drive them around. Then when the driver hits release (Button in front of car). The weld is destroyed and they are teleported behind the car door. But instead they get teleported where I want them then right back to inside vehicle why? Here is my script:
script.Parent.ClickDetector.MouseClick:connect(function()
if PlName.Value ~= "" then
local Player = game.Workspace:FindFirstChild(PlName.Value)
if Player then
Player.Keeper:Destroy()
Player.Torso.Weld:Destroy()
Player.Torso.CFrame = script.Parent.Parent.Parent.GoTo.CFrame + Vector3.new(0,4,0)
Door.CanCollide = false
Player.Humanoid.PlatformStand = false
wait(5)
Debounce = false
local Pl = game.Players:FindFirstChild(PlName.Value)
if Pl then
local Items = game.ReplicatedStorage.KVTT:GetChildren()
for i=1, #Items do
if Items[i].ClassName == "Tool" or Items[i].ClassName == "HopperBin" then
local clone = Items[i]:Clone()
clone.Parent = Pl.Backpack
Items[i]:Destroy()
end
end
end
PlName.Value = ""
end
end
end) |