Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i solve this unfamiliar error?

--[[ http://prntscr.com/a7b4tr

http://prntscr.com/a7b3hl

http://prntscr.com/a8geq1

--Problem: When you equip the tool the gui dose not popup

---New Error: 14:09:15.828 - Players.Player.Backpack.WoodenPickaxe.LocalScript:14: bad argument #3 to 'Text' (string expected, got Object) --14:09:15.831 - Script 'Players.Player.Backpack.WoodenPickaxe.LocalScript', Line 14 --14:09:15.833 - Stack End

local Player = game.Players.LocalPlayer
local Durrability = Player:WaitForChild("PlayerGui"):WaitForChild("Durrability")
local Gui = Durrability:WaitForChild("Durrability"):WaitForChild("Background"):WaitForChild("DurVal")
local Gui2 = Durrability:WaitForChild("Durrability"):WaitForChild("Background"):WaitForChild("DurVal2")
local Gui3 = Durrability:WaitForChild("Durrability")

Item2 = Player.Backpack:WaitForChild('WoodenAxe')
Item = Item2:WaitForChild('CurrentDurability')

script.Parent.Equipped:connect(function() 
	wait(.1)
    Gui3.Visible = true	
    Gui.Text = Item
    Gui2.Text = Item
end)

script.Parent.UnEquipped:connect(function()
	wait(.1) 
    Gui.Text = " "
    Gui2.Text = " "		
    Gui3.Visible = false
end)

1 answer

Just append .Value after Item. Since CurrentDurability is probably a NumberValue, you want to set the Text of Gui and Gui2 to the Value of the NumberValue, not the NumberValue (an object) itself.

Line 13 and 14 would look like this:

Gui.Text = Item.Value
Gui2.Text = Item.Value

This discussion is preserved as it was. New answers, comments, and votes are closed.