Door script spawning in random copy blocks

I’m trying to make a horror game based in a school, and I’m having some problems with the doors.

Basically, I’m trying to make a sliding door for the game (using tweening) and whenever i open the door, random parts appear (this just started happening not too long ago) for a while it worked fine.
glitch

I’ve tried looking on the dev forum, and I can’t find anything about what’s happening to me. I’ve even asked some of my dev friends (one is a scripter for car crushers 2) but they’re all offline, and I’m very impatient.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

This is the script:

local runServ = game:GetService("RunService")

local tween = function(t, alpha)
	return math.pow(t, alpha)/(math.pow(t, alpha) + math.pow(1-t, alpha))
end

local active = false
local open = false
local model = script.Parent.Parent
script.Parent.ClickDetector.MouseClick:Connect(function()
	local frame = model.PrimaryPart.CFrame
	if active then return end
	active = true
	if not open then
		for i = 1, 80, 1 do
			local t = i/80
			model:SetPrimaryPartCFrame(frame:lerp(frame*CFrame.new(-3,0,0),tween(t,2)))
			runServ.Heartbeat:Wait()
		end
		open = true
	else
		for i = 1, 80, 1 do
			local t = i/80
			model:SetPrimaryPartCFrame(frame:lerp(frame*CFrame.new(3,0,0),tween(t,2)))
			runServ.Heartbeat:Wait()
		end
		open = false
	end
	active = false
end)

script.Parent.ClickDetector.CursorIcon = "rbxassetid://6168564135" <<< IRRELEVANT CUSTOM CURSOR THINGY

Please reply if you need any further information.

These parts are welded together correct? and the model themselves have a primarypart set?

And if you don’t mind are you able to send a gif of the sliding doors to better explain the situation?

These parts just appear randomly? or are they actually part of the door?

It doesn’t look like a “random” part to me, it looks like a window that is part of the door that didn’t move with the door, probably because it accidentally got parented to something outside of the model and is therefore no longer a part of the door model.

Also, FWIW, CFraming collidable doors is generally problematic, especially if controlled from a server script. Movement can look jerky because network replication timing can be erratic. Putting the door on a prismatic constraint and using an AlignPosition instance is preferred and will give you a smoothly-moving door even when controlled by a server script.

1 Like

thank you so much, all I had to do was move the parts into the model. I don’t know how that happened.