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

Why wont this add and and multiply?

Asked by 4 years ago
Edited 4 years ago

I am trying to multiply a value with a value but it wont work. On line 10 is where the values are being added and multiplied

01local shopkeeper = game.Workspace:FindFirstChild("Sell your ore here!")
02local guiNoticeEvent = game.ReplicatedStorage:WaitForChild("GUINoticeEvent")
03RepStor = game:GetService("ReplicatedStorage")
04function onTouch(hit)
05    local humanoid = hit.Parent:FindFirstChild("Humanoid")
06    if (humanoid and humanoid ~= shopkeeper) then
07        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
08        if (player.InventoryValue.Value > 0) then
09            local savedValue = RepStor[player.Pickaxe.Value].multiplier.Value * player.RebirthMultipler.Value * player.InventoryValue.Value
10            player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + player.InventoryValue.Value * RepStor[player.Pickaxe.Value].multiplier.Value * player.RebirthMultipler.Value
11            player.InventoryValue.Value = 0
12            player.InventoryCount.Value = 0
13            guiNoticeEvent:FireClient(player, 0, savedValue)
14        end
15    end
16end
17script.Parent.Touched:Connect(onTouch)

where coins are generated

01local guiNoticeEvent = game.ReplicatedStorage:WaitForChild("GUINoticeEvent")
02function guiNotice(opcode, argl)
03    if (opcode == 0) then
04        local player = game.Players.LocalPlayer
05        local playerGui = player:WaitForChild("PlayerGui")
06        local text = Instance.new("TextLabel")
07        text.Parent = playerGui.MainGui
08        text.Name = "CoinsLabel"
09        text.Font = Enum.Font.Highway
10        text.Size = UDim2.new(0, 200, 0, 50)
11        text.AnchorPoint = Vector2.new(0.5, 0.5)
12        text.Position = UDim2.new(0.5, 0, 1, -90)
13        text.TextSize = 40
14        text.TextColor3 = Color3.fromRGB(255, 255, 0)
15        text.Text = "+" .. argl .. " Coins"
View all 51 lines...
1
could you tell us what is happening? that may help us solve your problem raid6n 2196 — 4y

1 answer

Log in to vote
0
Answered by
raid6n 2196 Moderation Voter Community Moderator
4 years ago

We resolved many things in the chat, but he forgot to multiply the saved value.

Edited line 8:

1local savedValue = RepStor[player.Pickaxe.Value].multiplier.Value * player.InventoryValue.Value
Ad

Answer this question