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

Workspace.Script:9: '=' expected near '-' what do i do? please help

local allPlayers = {}
for a,v in pairs(game.Players:Getchildren()) do 
table.insert(allPlayers,v)
end
local plrAmount = game.Players.Numplayers
local val1 = math.random(plrAmount)
local val2 
repeat
val2 - math.random(plrAmount)
wait(20)
until val2 ~=val1
allPlayers[val1].Character.Torso.CFrame = CFrame.new(0,0,0)
allplayers[val2].Character.Torso.CFrame = CFrame.new(665.995,7.1,-115.005)
math.randomseed(os.time())

it says Workspace.Script:9: '=' expected near '-' im not sure what to do

3 comments

0

Post as Lua Code and try again. I don't know what line is what because it is unformatted.

0

would i put val2 = val2 - math.random(plrAmount) on the 7th line?

0

Notice that "val2" is nil on line 7.

1 answer

✓ Accepted answer

val2 = val2 - math.random(plrAmount)

The variable is an integer value. To subtract, add, multiply, or divide a variable set as an integer, you must reset the variable. Resetting the variable is just like setting it in the first place. Except you do it like above, where you set the variable as itself, minus another variable, integer, or in this case, math.

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