SinClosed
(LK_Lulen)
February 1, 2022, 2:22pm
1
I’m getting an error of this code:
for i = randomBlockWorth,0,-1 do
wait(1)
local winnersBlock = rPlayer1.leaderstats.Block.Value
local winnersBlockR = game.Workspace:FindFirstChild(winnersBlock)
rPlayer1.BlockValue.Value += 1
winnersBlockR:Clone().Parent = workspace
winnersBlockR.Position += Vector3.new(0,3,0)
end
What’s wrong with it? I don’t understand???
1 Like
I think you are setting i=table not a value.
yungpharma
(GooseCreekGrimReaper)
February 1, 2022, 2:31pm
3
SinClosed:
for i = randomBlockWorth,0,-1 do
wait(1)
local winnersBlock = rPlayer1.leaderstats.Block.Value
local winnersBlockR = game.Workspace:FindFirstChild(winnersBlock)
rPlayer1.BlockValue.Value += 1
winnersBlockR:Clone().Parent = workspace
winnersBlockR.Position += Vector3.new(0,3,0)
end
I think you meant to get a random value from that table, which you could do like this:
for i = randomBlockWorth[math.random(1, #randomBlockWorth)], 0, -1 do
end
SinClosed
(LK_Lulen)
February 1, 2022, 3:54pm
4
Random block worth is a number though…
SinClosed
(LK_Lulen)
February 1, 2022, 3:55pm
5
A math.random number i put:
local randomBlockWorth = math.random(1,10)
yungpharma
(GooseCreekGrimReaper)
February 1, 2022, 4:25pm
6
maybe you might’ve shadowed the variable? I believe it wouldn’t do that if that was the case
SinClosed
(LK_Lulen)
February 1, 2022, 4:27pm
7
ok thanks yoours works already