local UIS = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
UIS.InputChanged:Connect(function()
if mouse.Target then
if mouse.Target.Interact then
script.Parent.Enabled = true
else
script.Parent.Enabled = false
end
end
end)
So basically this script enables a gui if the object has an intvalue called interact in it. But when I look away from that object the gui does not go away. I probably did this very wrong so please help
