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

why does this function not get the item's name??

Asked by 7 years ago

the script is

game.Players.LocalPlayer:WaitForChild("Swords", 5)
game.Players.LocalPlayer:WaitForChild("TotalSwordValue", 5)
tot = game.Players.LocalPlayer:WaitForChild('TotalSwordValue')
scrol = script.Parent.ScrollingFrame
player = game.Players.LocalPlayer

game.Players.LocalPlayer.Swords.ChildAdded:connect(function(item)
    print(item.Name.."Added")

    if tot.Value == 1 then
        scrol.Item.Text = item.Name
        player.TotalSwordValue.Value = player.TotalSwordValue.Value + 1
    end
end)

i dont see any errors in the output....

if you wanna know what the script does do not look at the totalswordvalue it is supposed to give a textbutton the name of an item added to a folder called 'Swords' the folder is inside the player... if there is more info needed just ask.

0
This is in a Local Script or a Regular Script? OldPalHappy 1477 — 7y
0
localscript its for an inventory gui kinda thing TigerClaws454 48 — 7y
0
if it is a regular script it would give the name of the item to everybody's gui so.. TigerClaws454 48 — 7y
0
Do you insert anything into the swords folder by hand? RubenKan 3615 — 7y
View all comments (4 more)
0
no TigerClaws454 48 — 7y
0
i insert it by script if you press a buy button in a shop gui there is a boolvalue added to the folder and that boolvalue's name would be what is supposed to be displayed as item.Name TigerClaws454 48 — 7y
0
Are you sure that it gets added to it? It should atleast print "Added" if it actualy adds something. (Or error, but you said that it didn't) RubenKan 3615 — 7y
0
I see nothing wrong with the ChildAdded event. Could it be that the other variables,perhaps, are incorrectly linked? rexbit 707 — 7y

Answer this question