I made a script that if the player is hit by the bumper of a car and the car gear is in 2nd the player get falls over, but it doesnt seem to work at all, im sure it works but it isnt for some reason, any help maybe?
script.Parent.Touched:Connect(function(HitPart)
local Character = HitPart.Parent
local carspeed = script.Parent.Parent.ebux:WaitForChild("Gear").Value
local Humanoid = Character:FindFirstChild("Humanoid")
if Humanoid ~= nil and carspeed == 2 then
Humanoid.Sit = true
Humanoid.Health -= 35
script.Parent.Sound:Play()
script.Disabled = true
wait(3)
script.Disabled = false
Humanoid.Sit = false
script.Parent.Sound:Stop()
end
end)
Yeah so its not working, basically carspeed is like a value that measured by the car gear, so the script basically tells the gear value to turn into 2 after an amount of rpm, so what my attempt to do was make it so the if the car is put to second gear or above, the player can be hit by the vehicle
But if the car is below 2nd gear like in first gear the player cant get hit by the car because it isnt going fast enough
if (canShift==true) then
if seat.Throttle==1 and car.RPM.Value>6.6 and gear<numgears and not r then
shift(1)
elseif seat.Throttle<1 and car.RPM.Value<4 and gear>1 then
shift(-1)
end
end
end)
Check to see if carspeed is even reaching 2 with a print before the if statement if it doesnβt print 2 than your issue is probably in your other script. Also if your gears go above 2 change it to carspeed >= 2.