So I'm trying to make a class-based game. Right now I'm testing it out on roblox gear.
So. I'm trying to prevent the person from being able to click again if they already have the tool. Here's the script:
textButton = script.Parent
spawns = {game.Workspace.SpawnLocation1 , game.Workspace.SpawnLocation2 , game.Workspace.SpawnLocation3 , game.Workspace.SpawnLocation4}
player = script.Parent.Parent.Parent.Parent
Trowel = game.ReplicatedStorage.ClassicTrowel:Clone()
already = player.Backpack:FindFirstChild("ClassicTrowel")
if already == nil then
textButton.MouseButton1Down:connect(function()
script.Parent.Text = "5"
wait(1)
script.Parent.Text = "4"
wait(1)
script.Parent.Text = "3"
wait(1)
script.Parent.Text = "2"
wait(1)
script.Parent.Text = "1"
wait(1)
player.Character:MoveTo(spawns[math.random(1, #spawns)].Position)
player.Character.Humanoid.MaxHealth = 200
player.Character.Humanoid.Health = 200
Trowel:Clone().Parent = player.Backpack
Trowel:Clone().Parent = player.StarterGear
script.Parent.Text = "Change to Builder"
end)
else return
end

1 comment
It works already, it just doesn't prevent them from clicking it again