I want to change the position of the player when I collide with a vehicle.
I want the car to move in the direction it is looking at.
local seat =script.Parent.Parent.Parent.Parent.DriveSeat
local Enabled = true --중복데미지방지
local carpos = workspace.Sportcar.Body.Sportcar:WaitForChild("HumanoidRootPart")
local function carcollide (otherPart)
local player = otherPart.parent
local humanoid = player:WaitForChild("Humanoid")
local falldown = Instance.new("Animation",player)
falldown.AnimationId = "rbxassetid://12378189610"
local fall = humanoid:LoadAnimation(falldown)
--local Pos = player:WaitForChild("HumanoidRootPart") --닿는 플레이어 위치찾기
--local PosCframe = Pos.RootRigAttachment.WorldCFrame.Position --닿는 플레이어 위치찾기
local varX = carpos:GetPivot().X*0.2*script.Parent.AssemblyLinearVelocity.Magnitude / 10
local varZ = carpos:GetPivot().Z*0.2*script.Parent.AssemblyLinearVelocity.Magnitude / 10
if humanoid and seat.Occupant ~= nil and Enabled then
Enabled = false
player:MoveTo(Vector3.new(varX,0+8,varZ))
fall:play()
wait(2)
Enabled = true
end
end
script.Parent.Touched:Connect(carcollide)

robloxapp-20230308-0142555.wmv (1.4 MB)