Stop player from glitching into moving part

Basically I have a pillar that is going upwards like an elevator and when it pushes the player the player gets stuck in it and then gets glitched out.


It seems pretty simple but I don’t know how to stop that from happening.

1 Like

could you show the part of the code where you set the parts cframe

local pillar = Instance.new("Part")
pillar.Name = "pillar"
pillar.Parent = workspace
pillar.Anchored = true

local pillarWL = math.random(20,30)
local pillarH = math.random(75,120)
pillar.Size = Vector3.new(pillarWL,pillarH,pillarWL)
			
local mousePos = mouse.Hit.Position
pillar.Position = Vector3.new(mousePos.X,0,mousePos.Z) - Vector3.new(0,pillarH,0)

local tweenInfo = TweenInfo.new(3, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out)
local tween1 = game:GetService("TweenService"):Create(pillar, tweenInfo, {Position = pillar.Position + Vector3.new(0,pillarH * 1.5,0)})
tween1:Play()
local mousePos = mouse.Hit.Position
pillar.Position = Vector3.new(mousePos.X,0,mousePos.Z) - Vector3.new(0,pillarH + 3,0)

maybe this works? try it out i just made it so the pillar spawns a little bit below ground

the same thing still happens unforunately :confused:

im not sure there even is something you can do besides lowering the speed so making the duration of the tween longer, I was going to recommend setting the player rootparts cframe at the top of the pillar while its going up but i noticed that the script actually makes a pillar wherever your mouse is, not under your character so I honestly dont know what you could do

1 Like

Weld a transparent block to the top of the pillar with collide on, by whatever height stops it from looking like they went into the pillar. After the pillar reaches the top remove the block, if they are meant to walk on it. I take it that is a tween moving the pillar. If it was part of a for next loop you could use stepped:wait() in the loop and that would most likely fix it the way it is … and still keep it move up fast like that.

I think it is due to the pillar being summoned too fast. Try slowing down the speed and seeing if it works then.

it is and it’s most likely a tween

use vector force and prismatic constraint instead if you need it to be that fast
https://vimeo.com/904856107?share=copy
edit(I’m pretty sure if you tween in the client it will be a lot smoother)

how do you do this? i have been trying to do it and i cannot really understand both vectorforce and prismatic constraints

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.