How would I get a model to move if there is a certain amount of players touching it? I'm trying to get a vehicle to move by itself when there are at least 5 players inside it.
This is the code I have so far, it gets the vehicle to move on its own:
for i = 0,100,.1 do script.Parent:TranslateBy(Vector3.new(i,0,0)) wait(.1) end
This is what i would do:
while true do local part = Your part local Occupants = {} part.Touched:Connect(function(hit) for i,v in pairs(hit.Parent.model:GetChildren()) do -- This is just an example of a model. if v:IsA("VehicleSeat") then if v.Occupant ~= nil then table.insert(Occupants,v.Occupant.Parent) end end end print("There are "..#Occupants.." on this vehicle") end if #Occupants == 5 then for i = 0,100,0.01 do script.Parent:TranslateBy(Vector3.new(i,0,0)) wait(0.05) wait() end end end end)
Im assuming that you mean that 5 players have to be seated in the model. I don't really know what you mean with "inside the vehicle."
I hope this helps, if this doesn't help just send a message.