Im trying to make this script work. It is FE but I dont see why it would matter because it is in a server script with click detector. This is what I have tried doing but searched online and dont see why it keeps going out of place.
local Open = false script.Parent.ClickDetector.MouseClick:Connect(function() if Open == false then script.Parent.Size = Vector3.new(0.2, 0.2, 2.1) script.Parent.Position = Vector3.new(-312.8, 14.61, 467.85) Open = true else script.Parent.Size = Vector3.new(0.1, 3.6, 2.1) script.Parent.Position = Vector3.new(-312.75, 13.91, 467.85) Open = false end end)
It works but the position keeps going a few studs on top or just dissapears.
When you set the Position property of an Object with a Parent which is a descendant of the workspace, it will teleport up until it is no longer colliding with another object. Try setting the CFrame instead?
local Open = false script.Parent.ClickDetector.MouseClick:Connect(function() if Open == false then script.Parent.Size = Vector3.new(0.2, 0.2, 2.1) script.Parent.CFrame = CFrame.new(-312.8, 14.61, 467.85) Open = true else script.Parent.Size = Vector3.new(0.1, 3.6, 2.1) script.Parent.CFrame = CFrame.new(-312.75, 13.91, 467.85) Open = false end end)