Im trying to make a clickable UI Object that will add amounts of value that will represent the recourses you have, why am I getting this error?
11:40:55.217 Players.NubblyFry.PlayerGui.MainGui.ScrollingFrame.Bronze Cork Screw.AddVal:10: attempt to perform arithmetic (mul) on Instance - Client - AddVal:10
11:40:55.218 Stack Begin - Studio
11:40:55.218 Script 'Players.NubblyFry.PlayerGui.MainGui.ScrollingFrame.Bronze Cork Screw.AddVal', Line 10 - Studio - AddVal:10
11:40:55.219 Stack End - Studio
Script
local cooldown = false
local Amount = script.Parent:WaitForChild("Amount")
local Multiplier = game:GetService("ReplicatedStorage"):WaitForChild("Values").Multiplier
script.Parent.MouseButton1Click:Connect(function()
if cooldown == false then
cooldown = true
Amount = Amount * Multiplier
task.wait(1)
cooldown = false
end
end)
Line 10 ( Amount = Amount * Multiplier )
--//Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
--//Variables
local Multiplier = ReplicatedStorage:WaitForChild("Values").Multiplier
local Button = script.Parent
local Amount = Button:WaitForChild("Amount")
--//Controls
local Cooldown = false
--//Functions
Button.MouseButton1Click:Connect(function()
if not Cooldown then
Cooldown = true
Amount.Value *= Multiplier.Value
task.wait(1)
Cooldown = false
end
end)
Amount.Value *= Multiplier.Value is a shortened version of Amount.Value = Amount.Value * Multiplier.Value as they both do the exact same thing but I just prefer the first one as it looks nicer.