local collectionService = game:GetService("CollectionService")
local function boatStuff(boat)
local driversSeat = boat.VehicleSeat
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {workspace.Terrain}
raycastParams.FilterType = Enum.RaycastFilterType.Whitelist
driversSeat.Changed:Connect(function()
boat.AngularVelocity.AngularVelocity = Vector3.new(0, -1 * driversSeat.Steer, 0)
boat.LinearVelocity.LineVelocity = 50 * driversSeat.Throttle
end)
while task.wait() do
local startingPos = boat.VehicleSeat.Position + Vector3.new(0, 5, 0)
local endingPos = boat.VehicleSeat.Position - Vector3.new(0, 15, 0)
local ray = workspace:Raycast(startingPos, endingPos - startingPos, raycastParams)
if ray and ray.Material == Enum.Material.Water then
boat.AngularVelocity.Enabled = true
boat.LinearVelocity.Enabled = true
else
boat.AngularVelocity.Enabled = false
boat.LinearVelocity.Enabled = false
end
end
end
for _, boat in pairs(collectionService:GetTagged("Boat")) do
print(boat.Name)
boatStuff(boat)
end
at the moment this is only printing one of the models tagged with the Boat tag, how can I change my code so that it will take in all models that are tagged with the boat tag
what can i use or do instead of the while wait loop which is causing the issue while still making sure that the boat will not move if it is not touching the water terrain.
many thanks in advance 
