So I made a spawncar system. It simply checks if a car is named the playername and if it is, then it will destroy it. Thing is, If the player is sitting in the car at the moment, the car will get destroyed normaly BUT the player behaves very weird. It slides around like it is still in the car or something. Kind of like there is Ice underneath him.
I tried to maybe change the position of Sit to false because I was thinking maybe that was the reason. But I think it has something to do with the velocity of my character.
game.ReplicatedStorage.Events.SpawnCar.OnServerEvent:Connect(function(player,carName,carColor)
if game.Workspace:FindFirstChild(player.Name.."-Car") ~= nil then
game.Workspace:FindFirstChild(player.Name).Humanoid.Sit = false
game.Workspace:FindFirstChild(player.Name.."-Car"):Destroy()
print(player.Name.." car got destroyed")
else
print("Creating car for "..player.Name)
local carClone = game.ServerStorage.Cars["Supercar"]:Clone()
carClone.Parent = workspace
carClone.Name = player.Name.."-Car"
local position = player.Character.HumanoidRootPart.Position + Vector3.new(0,2,15)
carClone:SetPrimaryPartCFrame(CFrame.new(position))
end
end)
