When i activate the tool and any time it is suppose to make a frame visible, it doesn't work?

plr = script.Parent.Parent.Parent
char = plr.Character
hum = char.Humanoid
--------------------------------------
local enabled = true
local delaytime = plr:WaitForChild("delay")
local defaultdelay = 10
--------------------------------------
local storage = game.ServerStorage
local crates = storage.crates
local remotes = storage.remotes
--------------------------------------
script.Parent.Activated:Connect(function()
	if enabled == true then
		print("delay ok")
		if hum.FloorMaterial == Enum.Material.Plastic then
			print("plastic")
		enabled = false
		wait(defaultdelay)
		enabled = true
		else
			print("not plastic")
			plr.PlayerGui.DeployWarning.Frame.Visible = true
		end
	else
		print("delay not ok")
		plr.PlayerGui.DelayWarning.Frame.Visible = true
	end
end)