local Player
Part.Touched:Connect(function(HIT)
local function playerHasTool(player, toolName)
local tool = player.Backpack:FindFirstChild(toolName) or player.Character:FindFirstChild(toolName)
if tool then
return true
else
return false
end
end
Player = game.Players:GetPlayerFromCharacter(HIT.Parent)
local H = HIT.Parent:FindFirstChild("Humanoid")
if H and not game.ReplicatedStorage:FindFirstChild("MediterraneanAvenue") and not playerHasTool(Player,"MediterraneanAvenue") then
print("Conditional recognized.")
game.Players.LocalPlayer.PlayerGui.MediterraneanAvenue.PayRent.Visible = true
This script is supposed to make GUI visible for the player who doesnt have the tool "Mediterranean Avenue" and if tool isn't found in replicated storage.
But strangely, when tested, the GUI becomes visible for the player who has the tool.
The gui is located at game.StarterGui.MediterraneanAvenue.PayRent (PayRent is a frame) the above script is a local script inside a text button, which is inside PayRent.
I basically want the GUI to appear when a player touches the part and if the conditionals are satisfied. Please help me!

1 comment
playerHasTool() will return false for Player that don't have tool and the condition is still meet because not false == true.