I am trying to multiply coins using string values that are attached to the player, one of the string values attached to is Pickaxe, this is the pickaxe that is saved when they join the game, inside the pickaxe is a multiplier value which will multiply the coins, here I tryed getting the Item in the ReplicatedStorage by using the value attached to the player, but it didn't work and the title is the error
local shopkeeper = game.Workspace:FindFirstChild("Sell your ore here!") local guiNoticeEvent = game.ReplicatedStorage:WaitForChild("GUINoticeEvent") RepStor = game:GetService("ReplicatedStorage") function onTouch(hit) local humanoid = hit.Parent:FindFirstChild("Humanoid") if (humanoid and humanoid ~= shopkeeper) then local player = game.Players:GetPlayerFromCharacter(hit.Parent) if (player.InventoryValue.Value > 0) then local savedValue = player.InventoryValue.Value player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + player.InventoryValue.Value * RepStor[player.Pickaxe.Value] player.InventoryValue.Value = 0 player.InventoryCount.Value = 0 guiNoticeEvent:FireClient(player, 0, savedValue) end end end script.Parent.Touched:Connect(onTouch)
The errors says whats wrong ur trying to multiply a number and an instance
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + player.InventoryValue.Value * RepStor[player.Pickaxe.Value]
it happens on this line more specific
player.InventoryValue.Value * RepStor[player.Pickaxe.Value]
because RepStor[player.Pickaxe.Value]
is not a number but an instance