Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

4 comments

0

Also its a number value

0

do "You will be payed 300 KR in " .. amount .. " seconds" as ".." is the concatenation operator in lua.

0

and btw the past simple of pay is paid :)

0

Lmao LA wasn't my best

1 answer

✓ Accepted answer

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"

1 comment

0

I do kind of get confusing when switching between langauges

This discussion is preserved as it was. New answers, comments, and votes are closed.