in the 12th line of code, I need help trying too get the *GiveTo* too work. How do you do it?
Asked by
5 years ago Edited 5 years ago
Hello, I have a basic fix but I don't know if it is correct. What would you do too be able too actually make this function and work as a item giver in Miners Haven
01 | local repStorage = game:GetService( "ReplicatedStorage" ) |
02 | local remote = repStorage:WaitForChild( "remote" , 400 ) |
03 | local InsertService = game:GetService( "InsertService" ) |
04 | function getItemFromId(id) |
05 | for _,v in pairs (game.ReplicatedStorage.Items:GetChildren()) do |
06 | if v.ItemId.Value = = id then |
11 | remote.OnServerEvent:Connect( function (player, ItemID, GiveTo, Amount) |
13 | local ItemId = tonumber (ItemID) |
16 | print (getItemFromId(ItemId)) |
17 | game.ServerStorage.AwardItem:Invoke(plr, ItemId, Amount) |
18 | game.ReplicatedStorage.Hint:FireClient(plr, player.Name.. " has given you" .. getItemFromId(ItemId)) |
If you can answer this question please do, I would love too hear back from you.. I cannot do this by myself and need help, try too be thorough and very detailed, I have a hard time actually like knowing what people are talking about so, if you can answer this in some way I will understand that would be greatly appreciated
I tried doing local plr = (ItemID,Amount,Player) GiveTo but I know that is wrong and can't seem too get it down..