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

How to use math.random?

Asked by 10 years ago

I'm having a bit of trouble with this. It says I can't use math.random, but I'm not sure what else to use. 'Up' is a member of the Player (There's a script for it). Could someone help me out?

s = game.Workspace:GetChildren()

function Down()
    for i,v in pairs(game.Workspace:GetChildren()) do
            if v.Name == "SpawnLocation" then
                plr.Character:MoveTo(math.random(1,v.Position))
                a = false
            end
    end
end

function Up()
    for i,v in pairs(game.Workspace.Lobby:GetChildren()) do
        if v.Name == "SpawnLocationU" then
            plr.Character:MoveTo(math.random(2,v.Position))
        end
    end
end

game.Players.PlayerAdded:connect(function(p)
    game.Workspace.CharacterAdded:connect(function(char)
        if p.Up.Value == false then
            Down()
        elseif p.Up.Value == true then
            Up()
        end
    end)
end)
0
Player is not defined so I'm going to do major editing! :) HexC3D 830 — 10y
0
Can you cut off the parts you do not have errors on? HexC3D 830 — 10y
0
@Hex, You may be right. Fail..... I'll go check it out (I was helping him with this script) Shawnyg 4330 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

You probably have to specify what X/Y/Z Position you are using.

0
He does not have to do that. HexC3D 830 — 10y
Ad

Answer this question