local ToolTable = {
["Sword"] = {
Damage = 10,
Range = 5
},
["Hammer"] = {
Damage = 20,
Range = 2
}
}
local Sword = game:GetService("StarterPack"):WaitForChild("Sword")
local Hammer = game:GetService("StarterPack"):WaitForChild("Hammer")
Sword.Equipped:Connect(function()
for Info, value in pairs(ToolTable["Sword"]) do
print(Info,value)
end
end)
#Why does nothing print>?
1 messages · Page 1 of 1 (latest)
What is info and value?
Oh nvm
It's just that i'm used to i,v
np
doesn't print anything
this is in a server script
im trynna see if it works in a local rn
I think it is a problem with the way you are trying to access the sword object
things in starter pack gets replicated to the player's backpack on game start
Ipairs is like in order i think
Also try printing something after you equip the sword
That will tell you what's wrong
so to get the actual sword that is in the player's inventory ou need to go through the player backpack
Yeah so try printing
found out the issue
similar difference between starterGui and playergui
had to put it into startercharacter
local ToolTable = {
["Sword"] = {
Damage = 10,
Range = 5
},
["Hammer"] = {
Damage = 20,
Range = 2
}
}
local player = game.Players.LocalPlayer
local Sword = player.Backpack:WaitForChild("Sword")
local Hammer = player.Backpack:WaitForChild("Hammer")
Sword.Equipped:Connect(function()
for Info, value in pairs(ToolTable["Sword"]) do
print(Info,value)
end
end)
and changed the scripot
to this
Thank you all for trynna help, sorry if I wasted your time.