I want to make an orb spawn in a random position in an area.
It keeps saying that the argument
I tried making the game wait because this is a cloned model rather than a previously existing one. I also tried making the “WaitForChild(”“)” just a blunt period.
– I can assure you that OrbAreaZ1 & 2 are both areas, same with the Xs
local Player = game.Players.LocalPlayer.Character
local function ADDWALL()
if Player.FightEnabler.Value == true then
local Wall = game.ReplicatedStorage.Wall:Clone()
Wall.Parent = game.Players.LocalPlayer.Character
Wall:PivotTo(CFrame.new(Player.HumanoidRootPart.Position.X, (Player.HumanoidRootPart.Position.Y-5), Player.HumanoidRootPart.Position.Z))
Wall:ScaleTo(Player.Range.Value)
end
end
game.Players.LocalPlayer.Character:WaitForChild("FightEnabler"):GetPropertyChangedSignal("Value"):Connect(ADDWALL)
ADDWALL()
local function StartOrbs()
if Player.FightEnabler.Value == true then
local Arrow = game.ReplicatedStorage.Orbs.StackBow.ArrowOrb:Clone()
Arrow.Parent = workspace
local OrbPositionZ = math.random(Player:WaitForChild("Wall"):WaitForChild("OrbAreaZ1").Position.Z, Player:WaitForChild("Wall").OrbAreaZ2.Position.Z)
local OrbPositionX = math.random(Player.Wall.OrbAreaX1.Position.X, Player.Wall.OrbAreaX2.Position.X)
local OrbPositionY = Player.Wall:GetModelCFrame()
Arrow:PivotTo(CFrame.new(OrbPositionX, (OrbPositionY.Y + 10), OrbPositionZ))
print(OrbPositionX)
print(OrbPositionZ)
print("WORK")
end
print("FAIL-URE")
end
Player:WaitForChild("FightEnabler"):GetPropertyChangedSignal("Value"):Connect(StartOrbs)
StartOrbs()