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

Keep getting "attempt to perform arithmetic on a string value"?

Asked by 6 years ago

Error Players.Spiik3yViinH.PlayerGui.Radio.Wallet.Text.LocalScript:5: attempt to perform arithmetic on a string value

Local Script

while wait(0.1) do
    local amount = game.ReplicatedStorage.GetMoneyValue:InvokeServer("Timer")
    script.Parent.Text = "You will be payed 300 KR in "+amount+" seconds"
end

Server Script

local moneyfolder = game.ServerStorage:WaitForChild("Cash")

game.ReplicatedStorage.GetMoneyValue.OnServerInvoke = function(p,valuename)
    local playerfolder = moneyfolder:FindFirstChild(p.Name)
    local value = playerfolder:FindFirstChild(valuename)
    return(value.Value)
end
0
Also its a number value NovusDev 25 — 6y
0
do ```"You will be payed 300 KR in " .. amount .. " seconds"``` as ".." is the concatenation operator in lua. radusavin366 617 — 6y
0
and btw the past simple of pay is paid :) radusavin366 617 — 6y
0
Lmao LA wasn't my best NovusDev 25 — 6y

1 answer

Log in to vote
0
Answered by
aazkao 787 Moderation Voter
6 years ago

You know java? because "+" is how we concatenate strings in java

For roblox, concatenating strings is done with ".."

script.Parent.Text = "You will be payed 300 KR in "..amount.." seconds"
0
I do kind of get confusing when switching between langauges NovusDev 25 — 6y
Ad

Answer this question