Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

The doors are not opening? Somebody please investigate!

Asked by 2 years ago

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!

0
maybe.. actually call the functions??? lmao go to the next tutorial maybe there it will work greatneil80 2647 — 2y
0
i call the functions in the other script im pretty sure. Amazingamer12349 0 — 2y
0
do it in the same script, pretty sure you cant call functions from another script TabooAntonioiscool 42 — 2y

Answer this question