I've been working on elevators using Tween Service and here's 1 problem: Players legs or feet clip through the elevator. There's a big chance they'll clip out without doing any thing here's a preview:
Code:
local function Tween(t,s,d,p,o) return game.TweenService:Create(o,TweenInfo.new(t,Enum.EasingStyle[s],Enum.EasingDirection[d],0,false,0),p) end local OringinalDoorPos = script.Parent.Parent.Door.CFrame.p local FloorPos = script.Parent.Parent.Elevator.CFrame.p local OringinalPos = script.Parent.CFrame.p script.Parent.Touched:Connect(function(hit) if game.ServerStorage.Assets.PlayerData:FindFirstChild(hit.Parent.Name) then if game.ServerStorage.Assets.PlayerData[hit.Parent.Name].Joining.Value == true then return end game.ServerStorage.Assets.PlayerData[hit.Parent.Name].Joining.Value = 3 local plr = game.Players:GetPlayerFromCharacter(hit.Parent) hit.Parent.Humanoid.JumpPower = 0 game.ReplicatedStorage.Assets.Remotes.Notify:FireClient(plr,"A round will come soon") end end) script.Parent.TouchEnded:Connect(function(hit) if not hit then return end if not hit.Parent then return end if script.Parent.Parent.Door.CFrame.p ~= Vector3.new(249, 16.5, 0) then return end if game.ServerStorage.Assets.PlayerData:FindFirstChild(hit.Parent.Name) then game.ServerStorage.Assets.PlayerData[hit.Parent.Name].Joining.Value = 0 hit.Parent.Humanoid.JumpPower = 50 end end) local function GetJoiningPlayers() local plrs = {} for a,b in pairs(game.Players:GetPlayers()) do if game.ServerStorage.Assets.PlayerData[b.Name].Joining.Value == 3 then table.insert(plrs,b) end end return plrs end spawn(function() while wait(10) do local DoorTween1 = Tween(5,"Quad","Out",{Position = Vector3.new(243.5, 16, 30)},script.Parent.Parent.Door) DoorTween1:Play() DoorTween1.Completed:Wait() local ElevatorTween1 = Tween(25,"Quad","Out",{Position = Vector3.new(249, 219, 30)},script.Parent.Parent.Elevator) local OringinalTween1 = Tween(25,"Quad","Out",{Position = Vector3.new(249, 224.5, 30)},script.Parent) ElevatorTween1:Play() OringinalTween1:Play() OringinalTween1.Completed:wait() if #GetJoiningPlayers() >= 2 then for a,b in pairs(GetJoiningPlayers()) do local TS = game:GetService('TeleportService') TS:Teleport(3109126355,b,{EquippedItem = (game.ServerStorage.Assets.PlayerData[b.Name].EquippedGun.Value ~= "nil" and game.ServerStorage.Assets.PlayerData[b.Name].EquippedGun.Value ~= "" and game.ServerStorage.Assets.PlayerData[b.Name].EquippedGun.Value ~= nil) and game.ServerStorage.Assets.PlayerData[b.Name].EquippedGun.Value or "Broken Gun"}) end end wait(5) script.Parent.Parent.Elevator.Position = FloorPos script.Parent.Position = OringinalPos local DoorTween2 = Tween(5,"Quad","Out",{Position = Vector3.new(243.5, 4, 30)},script.Parent.Parent.Door) DoorTween2:Play() DoorTween2.Completed:Wait() end end)
How can I fix it?
This is a common problem when dealing with changing a basepart's location through a script.
Then how do people make smooth platforms for people to travel on?
In most cases, they set the part's anchored property to false and use instances such as the bodymovers to manipulate the part in various ways.
In this case, you could use a BodyPosition instance and change its position to the floors your elevator stops on.
As well as using a BodyGyro to keep the elevator's orientation the same.