How do I freeze a player and move it with an elevator?

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)
2 Likes

How does welding the character to the elevator sound like?

1 Like

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?

The player would still have to run with it, also, changing the player’s walk speed and jump power, could allow them to just jump away.

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.

Ok, I’ll try that. Just to make sure, if I unanchor all the parts of the character, it would kill them, right?

I’m not a scripter but, if it hasnt been said yet, try welding the player/s to a part of the elevator

Oh it has been said. Sorry :smile:

Also the character is already unanchored and held together with welds

1 Like

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)

I don’t know this will work just try.
Insret a part and add a serverscript insude it.

script

script.Parent.Touched:connect(function(p)

if p.Parent:FindFirstChild(“Humanoid”) then

p.Parent.Humanoid.WalkSpeed = 0

p.Parent.Humanoid.JumpPower = 0

That worked :smiley: Tysm for the help guys :slight_smile:

2 Likes

I didnt really help but No probs

Sorry I actually had to make it zero.
This was used in my game.