I'm following gnome codes 3rd doors fangame tutorial on how to make doors.

https://www.youtube.com/watch?v=Y84jSWrmXmE&ab_channel=GnomeCode

But when I play test, the doors won't open. Here is the code from the door script.

local TweenService = game:GetService("TweenService")

local door = {}

function door.Open(doorModel)
	doorModel:SetAttribute("Open", true)
	
	local cframe = doorModel.Hinge.CFrame * CFrame.Angles(0, math.rad(100), 0)
	local doorTween = TweenService:Create(doorModel.Hinge, TweenInfo.new(0.5) {CFrame = cframe})
	
	doorTween:Play()
end

function door.New(roomModel)
	local doorModel = workspace.Door:Clone()
	
	doorModel:PivotTo(roomModel.Exit.CFrame)
	doorModel:SetAttribute("Open", false)
	
	doorModel.Sensor.Touched:Connect(function(hit)
		local humanoid = hit.Parent:FindFirstChild("Humanoid")
		if humanoid and doorModel:GetAttribute("Open") == false then
			door.Open(doorModel)
		end
	end)
	
	doorModel.Parent = roomModel
	
	return doorModel
end

return door

Please somebody help!

3 comments

0

maybe.. actually call the functions??? lmao go to the next tutorial maybe there it will work

0

i call the functions in the other script im pretty sure.

0

do it in the same script, pretty sure you cant call functions from another script