So i'm trying to make a nightvision script. It works when I test the game, but doesn't work when I play the game online. How do I fix this?
script.Parent.Equipped:connect(function()
gui = Instance.new("ScreenGui", game.Players.LocalPlayer.PlayerGui)
local frame = Instance.new("Frame",gui)
frame.Size = UDim2.new(0.999, 0,0.994, 0)
frame.BackgroundColor3 = Color3.fromRGB(0, 212, 0)
frame.BackgroundTransparency = .6
end)
script.Parent.Unequipped:connect(function()
gui:Destroy()
end)

1 comment
Have you defined 'gui' earlier in the code?