Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why Do Two Tools Say Equipped When Really Only One Tool Is Equipped?

Asked by 5 years ago

Everything equip's fine, but if i equip a tool it says equip but then if i equip another too. both button say equipped when only the one tool is equipped. How do I make it to where only the one tool says equipped?

Heres the button script--

local modelName = script.Parent.Parent.ModelName

local boxName = script.Parent.Parent.Parent.CurrentBox



script.Parent.MouseButton1Click:Connect(function()



local outcome = game.ReplicatedStorage.CreateTransaction:InvokeServer(modelName.Value)



if outcome == true then

script.Parent.Text = "Equipped"

elseif outcome == "not enough pounds" then

elseif outcome == "already bought" then

if game.Players.LocalPlayer.Equipped.Value ~= modelName.Value then

game.ReplicatedStorage.EquipTool:FireServer(modelName.Value)

script.Parent.Text = "Equipped"

end

end



end)

boxName:GetPropertyChangedSignal("Value"):Connect(function()

local model = nil

for i, object in pairs(game.Workspace.ItemRoller["Box"..boxName.Value]:GetChildren()) do

if object:IsA("Model") then

model = object

end

end

local toolsBought = game.ReplicatedStorage.GetToolsBought:InvokeServer()

for i, tool in pairs(toolsBought) do

if tool == model.Name then

script.Parent.Text = "Equipped"

else

script.Parent.Text = "Equip"

end

end



end)

Answer this question