So I have a diagonal elevator that I Tween, however, when the tween starts the player just slides off, its position isn’t locked with the elevator. How would I move the player with the elevator? Here’s my current code:
local TweenService = game:GetService("TweenService")
local MovePlayers = {}
local pmodel = script.Parent.Players
local base = script.Parent.Base
local plrlist = {}
script.Parent.Controls.StartButton.ClickDetector.MouseClick:Connect(function()
--//Lock all players
script.Parent.Controls.StartButton.ClickDetector.MaxActivationDistance = 0
script.Parent.Controls.StartButton.Sound:Play()
local Info = TweenInfo.new(60,Enum.EasingStyle.Linear,Enum.EasingDirection.In,0,false,0)
local cf = {CFrame = script.Parent.To.CFrame}
local Tween = TweenService:Create(script.Parent.PrimaryPart,Info,cf)
wait(2.5)
Tween:Play()
repeat wait() until Tween.Completed
wait(1)
--//Unlock all players
end)
You can try to anchor the player parts and weld it to the elevator. When elevator reaches the position player has selected, all you have to do is reverse the process.
I tried welding the player, but I don’t think I got the player correctly. How would I get if the player is standing on the base of the elevator, and if they are, weld them?
Once they press a elevator button you will know if the player is in the elevator also you can create an invisible and anchored part in the elevator so you can know if the player is in elevator area by Touched and TouchEnded functions. You have to weld all the player parts also make sure to anchor it at this time as well to the elevator model and then only TweenService the primary part of elevator model.
It’s not going to kill them I just tested it in my place with a simple script.
game:GetService("Players").PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
for i,v in pairs(char:GetChildren()) do
if v:IsA("Part") then
v.Anchored = true
end
end
wait(4)
for i,v in pairs(char:GetChildren()) do
if v:IsA("Part") then
v.Anchored = false
end
end
end)
end)