So I made a script here:
wait(1)
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local place = "None"
for i, v in pairs(script.Parent:GetChildren()) do
if v:IsA("TextButton") then
v.Activated:Connect(function()
local boat = workspace.Boats:WaitForChild(v.Name)
place = v.Name
end)
end
end
while true do
if place == "Large" then
local boat = workspace.Boats:WaitForChild(place)
char.HumanoidRootPart.CFrame = boat.CFrame + Vector3.new(0, 10, 0)
elseif place == "Small" then
local boat = workspace.Boats:WaitForChild(place)
char.HumanoidRootPart.CFrame = boat.CFrame + Vector3.new(0, 10, 0)
elseif place == "Medium" then
local boat = workspace.Boats:WaitForChild(place)
char.HumanoidRootPart.CFrame = boat.CFrame + Vector3.new(0, 10, 0)
end
wait()
end
That would put your character on a certain boat if a button is pressed.
BUT, the character will stay stuck in the air in the while loop. Also, this only happens on the client.
So how would I make the player stay on the boat when it moves? Like:
- Player goes on small boat
- Small boat moves
- Player moves along with boat
Won’t
thing.Changed:Connect(function(change)
if change == "Position" then
--do code
end
end)
work?