Well... Lets try it
If you want you can also just use normal Parts.
First Step : First of all we need to know how many seats we have on our folder. I recommend to put the name like this, if is the sit one then put on the name "1". So the math.random() will be easier for you.
Second Step : Second, we need to know where's the player right now. And teleport it to the part or the seat. So we will use a Vector3.new function
Third Step : After completing all the steps before this one, only sit on your seat and enjoy your code.
Lets go to the code!
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local randomseat = math.random(1, 6)
local seat = workspace.inside.folder:WatiForChild(randomseat)
local humanoid = character:WaitForChild("Humanoid")
humanoid.HumanoidRootPart.CFrame = CFrame.new(seat.Position)
end)
end)
And that's all we need! Let me know if this solve your question!
Edit : I only change two lines of code. [9-10]
Keep scripting!
6 comments
why not usijng math.random(1, #seats) ?
It is telling me that vector3 is not a valid member of model?
Let me edit it again with CFrame.
Try it now @AdministrativeFellow
@Foxy_Developer its telling the same error except CFrame: CFrame is not a valid member of Model. Is this caused because my chair is just a giant union?
@AdministrativeFellow, try it now.