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

how to make a text labels text "+ (randomvalue)"?

so I'm making a cash per kills script and the amount of cash u get is random and I set

local gain = math.random(400,600)

and I want to spawn a text label to show how much I've gained and the spawn works but the text doesn't, heres the code for that

if hit.Parent.Humanoid.Health <= 0 then
	findYuan.Value = findYuan.Value + gain
	local change = game.Lighting.Misc.Change:Clone()
	change.Text = "+", gain
	change.Parent = game.Players:FindFirstChild(plrname).PlayerGui.HUD.Base
end

again, the only thing that doesn't work is the text for example if gain was equal to 525 then I would want the text to show up as "+525" and not just "525"

1 answer

✓ Accepted answer
if hit.Parent.Humanoid.Health <= 0 then
    findYuan.Value = findYuan.Value + gain
    local change = game.Lighting.Misc.Change:Clone()
    change.Text = "+"..gain
    change.Parent = game.Players:FindFirstChild(plrname).PlayerGui.HUD.Base
end

You are using a "," as the concat operator when in reality the concat operator is "..".

1 comment

0

eyyy thanks man

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