You can use the Touched event on the part and check if the bool value is false. part.Touched:Connect(function(hit)
if myBoolValue == false then
– Do something
end
end)
local ShopliftTrigger = script.Parent
local p = game.Players.Localplayer.Backpack:WaitForChild("cheese")
ShopliftTrigger.Touched:Connect(function(hit)
if game.ReplicatedStorage.Tools.Cheese.Purchased = false then
game.StarterGui.EndingUI.Enabled = true
game.StarterGui.EndingUI.TextLabel.Text = "Shoplift"
game.StarterGui.EndingUI.TextLabel1.Text = "Ending"
end
end)
but the problem is that it clones the tool from replicated storage so it wouldn’t work
also I would probally also so that the ui has to be dissabled if the value is true
Do not use StarterGui for guis. Use PlayerGui.
To make it so the cheese goes to the player backpack, use Cheese.Parent = game.Players.Localplayer.Backpack — if Cheese is a tool
Also refer to the Roblox Documentation for more references.