Why wont the player in the kart be pushed when the part is touched at the wrong direction? basically i am create a (Going wrong way part) the function will be fired an then check the Look Vector of the (Wrong way part) and then send the player backwards. Remembering the fact that it is a GO KART meaning the player is in a seat. :) Good luck understanding.

A bit of the local script-

elseif part.Name == "WrongWayCensor" and char.Humanoid.Sit then --IMPOSSIBLE TO MAKE

local PartLookVector = part.CFrame.LookVector

-- local KartLookVector = Kart.DriveSeat.CFrame.LookVector

WrongWayEvent:FireServer(part,char,Kart,PartLookVector)

A bit of the Server script

local function WrongWay(plr,part,char,Kart,PartLookVector)

local Barrier = part

local hit = (char)

if hit.Parent == nil then

return

end

warn("FOUND HUMANOID")

if hit:WaitForChild("Humanoid") then

local LookCF = CFrame.new(Barrier.Position, char.HumanoidRootPart.Position)

hit.HumanoidRootPart.Velocity = LookCF.LookVector * 100

warn("LOL")

-- local BodyVelocity = Instance.new("BodyVelocity")

-- BodyVelocity.Velocity = Vector3.new(0, 0, 0)

-- BodyVelocity.Parent = Kart.DriveSeat

-- BodyVelocity.Velocity = PartLookVector * 100 -- Push the Player back

-- warn(PartLookVector)

-- hit.UpperTorso.Velocity = LookVector * 100 -- Push the Player back

-- warn(LookVector)

-- hit.UpperTorso.Velocity:vectorToWorldSpace(lookVector * 100)

-- Kart.PrimaryPart.Velocity = Barrier.CFrame.lookVector * 900 -- Push the Player back

-- Kart.PrimaryPart.CFrame = Barrier.CFrame.lookVector + (Kart.PrimaryPart.CFrame.lookVector*100)

wait(2)

-- BodyVelocity:Destroy()

warn("PUSHED MA GUY G")

else

warn("CANT FIND IT BRO")

end

end

The warnings come up but the player and the kart does not get pushed back.

21:42:26.491 - FOUND HUMANOID 21:42:26.495 - LOL 21:42:28.495 - PUSHED MA GUY G

5 comments

0

As you can see by the green comments, i had many attempts.

0

"Good luck understanding" The whole point of asking for help is to make sure we understand what you are trying to do, so that we can help you.

0

Anyway, I think a better implementation of this would be to have an anchored part with cancollide set to false, and when a player in a kart passes through it, it just turns cancollide to true.

0

That way you could just use a touched event and you won't have to deal with vector calculations.

0

but that part is on the track, its like a check point.