So I have this as a local script in the GUI, this script is supposed to show the name of the weapon if and when a weapon is equipped. However I keep receiving the error: " Players.Player1.PlayerGui.Weapon Display.LocalScript:10: bad argument #1 to 'tostring' (value expected)"
I would like so help fixing this please, the script is:
local function GetWeaponEquipped()
for i,v in pairs(game.Players.LocalPlayer.Character:GetChildren()) do
if v:isA("Tool") then
return v.Name
end
end
end
print (GetWeaponEquipped())
local WepName = script.Parent.Frame.Text.Equipped
WepName.Text = GetWeaponEquipped() |