Scripting problem

why do you pcall? i dont think that needs pcall?

Yes but he said no error is getting printed either it works.So we are just doing doing a pcall function.

oh okay i guess i learned something new

Its ok.Everyday we will learn something new, we may find it or not

@UnboundTime Did it work? If not then I can give you another simplified script.

Ok looking into it more I think you are on track.

The issue here is floating point errors since you are using steer float. Steer Float will never equal one because it’s a float number. It’ll only become 0.9999 and fail the if statement check.

The better solution is to just set it like this

local att = script.Parent.Body:WaitForChild("AttachmentFL")

local MaxSteer = 30 --degree steering
local steerAmount = script.Parent.VehicleSeat.SteerFloat *MaxSteer
	att.Orientation = Vector3.new(0,steerAmount ,-90)

It’ll automatically change and be adjustable according to the input.

@dthecoolest and @Deadwoodx , unfortunately both those codes are still not working, I’m not sure why, I’ll send the chassis in a file.

The issue is that the code only runs once. Luckily the rig seems proper.

It needs to run continuously in order to detect the changes to steer float. You could use a while wait() loop like @Creeperman16487 mentioned but the issue is the floating point numbers if steer float is used. Personally I recommend a runservice loop so it’s more responsive but I would change a lot more things to be up to standards with the open source chassis (making the controls local for one thing) Currently as is, it’s prone to server lag as steer float takes time to update client to server.

local RunService = game:GetService("RunService")
local att = script.Parent.Body:WaitForChild("AttachmentFL")

RunService.Heartbeat:Connect(function()
local MaxSteer = 30 --degree steering
local steerAmount = script.Parent.VehicleSeat.SteerFloat * MaxSteer
att.Orientation = Vector3.new(0,-steerAmount ,-90)
end)
1 Like

Yes, that works fine :grinning: :+1:

I’m going to use this method for the throttle and the other wheels.

Thanks for the help!

Try using something like this instead of a loop.

script.Parent.VehicleSeat:GetPropertyChangedSignal("Steer"):Connect(function()

--update wheel orientation

end)

its unresponsive bro getpropertychangedsignal wont fire as fast enough

1 Like

Uh that is what I said :confused: maybe you did not understand what I said.I told to fire many times