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
01 | local shopkeeper = game.Workspace:FindFirstChild( "Sell your ore here!" ) |
02 | local guiNoticeEvent = game.ReplicatedStorage:WaitForChild( "GUINoticeEvent" ) |
03 | RepStor = game:GetService( "ReplicatedStorage" ) |
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) |
17 | script.Parent.Touched:Connect(onTouch) |
where coins are generated
01 | local guiNoticeEvent = game.ReplicatedStorage:WaitForChild( "GUINoticeEvent" ) |
02 | function guiNotice(opcode, argl) |
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 = UDim 2. new( 0 , 200 , 0 , 50 ) |
11 | text.AnchorPoint = Vector 2. new( 0.5 , 0.5 ) |
12 | text.Position = UDim 2. new( 0.5 , 0 , 1 , - 90 ) |
14 | text.TextColor 3 = Color 3. fromRGB( 255 , 255 , 0 ) |
15 | text.Text = "+" .. argl .. " Coins" |
16 | text.TextStrokeTransparency = 0 |
17 | text.BorderColor 3 = Color 3. fromRGB( 27 , 42 , 53 ) |
18 | text.BorderSizePixel = 1 |
19 | text.BackgroundTransparency = 1 |
20 | text.TextStrokeColor 3 = Color 3. fromRGB( 0 , 0 , 0 ) |
21 | text:TweenPosition(UDim 2. new( 0.5 , 0 , 1 , - 90 ), "In" , "Back" , 1 , false , nil ) |
23 | text:TweenPosition(UDim 2. new( 0.5 , 0 , 1 , 50 ), "Out" , "Back" , 1 , false , nil ) |
26 | elseif (opcode = = 1 ) then |
27 | local player = game.Players.LocalPlayer |
28 | local playerGui = player:WaitForChild( "PlayerGui" ) |
29 | local text = Instance.new( "TextLabel" ) |
30 | text.Parent = playerGui.MainGui |
31 | text.Name = "AlertLabel" |
32 | text.Font = Enum.Font.Highway |
33 | text.Size = UDim 2. new( 0 , 200 , 0 , 50 ) |
34 | text.AnchorPoint = Vector 2. new( 0.5 , 0.5 ) |
35 | text.Position = UDim 2. new( 0.5 , 0 , 1 , - 90 ) |
37 | text.TextColor 3 = Color 3. fromRGB( 255 , 0 , 0 ) |
38 | text.Text = "Backpack is full" |
39 | text.TextStrokeTransparency = 0 |
40 | text.BorderColor 3 = Color 3. fromRGB( 27 , 42 , 53 ) |
41 | text.BorderSizePixel = 1 |
42 | text.BackgroundTransparency = 1 |
43 | text.TextStrokeColor 3 = Color 3. fromRGB( 0 , 0 , 0 ) |
44 | text:TweenPosition(UDim 2. new( 0.5 , 0 , 1 , - 90 ), "In" , "Back" , 1 , false , nil ) |
46 | text:TweenPosition(UDim 2. new( 0.5 , 0 , 1 , 50 ), "Out" , "Back" , 1 , false , nil ) |
51 | guiNoticeEvent.OnClientEvent:Connect(guiNotice) |