script.Parent.Touched:Connect(function(Player)
if game.Players:GetPlayerFromCharacter(Player.Parent) then
local Seats = game.Workspace.MyTruckLane1.Seats
for i, v in pairs(Seats:GetChildren()) do
v:Sit(Player.Parent.Humanoid)
end
end
end)
Im not to sure why this isnt working and this is a shortened piece of code from a main script i cant understand why its not sitting the player. Does anyone have any answers?
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("HumanoidRootPart") then -- checking if its a player
local Seats = game.Workspace.MyTruckLane1.Seats
for i, v in pairs(Seats:GetChildren()) do
if v.Occupant == nil then -- checking if seat is not occupied
v:Sit(hit.Parent.Humanoid)
break -- break when script finds untaken seat
end
end
end
end)
For some reason it still isnt working im not sure why there is 8 seats in the folder “Seats” and the whole code it running its just not putting the player in the seat
This is strange, as in the documentation this is not mentioned. Also, when I test in Studio, Sit works in LocalScript.
But testing in Roblox Player, doesn’t always work.
Then I changed Sit to Server and it worked every time.
Another one of the darkest things about Roblox…