Problem
Hey guys since yesterday I’ve had a very unusual thing happen to me, I was trying to animate a door and it gave me an error saying "DoorGui is not a child of nil, which is “primaryPart” and not nil. To understand what I just said please look at the copy of the script I’ve put below.
Script
--//Variables
local RunService = game:GetService("RunService")
local UIS = game:GetService("UserInputService")
local primaryPart = game.Workspace.Doors.KeyDoor.PrimaryPart
local pressEToOpen = primaryPart.DoorGui
local player = game.Players.LocalPlayer
local event = game.Workspace.Doors.KeyDoor.DoorEvent
--//Events
RunService.RenderStepped:Connect(function()
if player:DistanceFromCharacter(primaryPart.Position) < 5 then
pressEToOpen.Enabled = true
else
pressEToOpen.Enabled = false
end
end)
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E then
event:FireServer()
end
end)