Limit To Part Position

Hello Developers. Currently, I am working on a game somewhat like Power Slap. Overall the process of developing the game has gone good but I’ve ran into problem that’s very very much bothering me.

You are allowed to just move the part everywhere making it so that the IkControl im using does weird stuff. And I want to add a position limit on the X-Axis that can be exceeded to prevent that.

How could I achieve something like this?

A Little Video Explaining The Issue:


local function MousePart()
	local Part ='Part',workspace)
	-- Set Settings / Part --
	Part.Size =,1,1)
	Part.Material = Enum.Material.SmoothPlastic
	Part.Anchored = true
	Part.CanCollide = false
	Part.Position = Character:WaitForChild('Head').Position
	-- While Statement --
	while true do
		Part.Position =,Part.Position.Y,Part.Position.Z)

First off, using, parent) is deprecated, switch to setting the parts parent outside of the instance.New thing

Second, you would probably want to check if the LocalMouse.Hit.X variable exceeds whatever number.

You could do something like,

if LocalMouse.Hit.X < 15 and LocalMouse.Hit.X > -15 then

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