local player = script.Parent.Parent.Parent.Parent.Parent
local gun = player.Backpack:FindFirstChild("Revolver") or player.Character:FindFirstChild("Revolver")
local tex = script.Parent.Text
script.Parent.MouseButton1Click:connect(function()
if gun ~= nil then
script.Parent.Text = "Gun Found"
wait(1)
script.Parent.Text = tex
elseif gun == nil then
script.Parent.Text = "Gun Not Found"
wait(1)
script.Parent.Text = tex
end
end)
this script is in a buttongui. i want the button gui change text to 'Gun Found' if gun is not nil but if the gun is nil i want the buttongui to change text to 'Gun Not Found'. it changes text if the gun is not found but when i place a gun in player backpack or in player the gui button will still change the text to 'Gun Not Found' it will not change the text to 'Gun Found' if the gun is found

3 comments
I've corrected a few issues with the script I've given you. Try it out, I'm in school right now so if there's a problem let me know please.
Couldn't you use a local script? That would work better for screen GUIs. If Acheo's fixes don't help I would just put this code in a local script. That would mean that for line one use local Player = game.Players.LocalPlayer. Try it if you're still having trouble.
i tried using local script but that would only work for studio it would not work on the roblox player