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

My airdrops spawn, but they are in the same position as in the first place. Any help?

Asked by 5 years ago
Edited 5 years ago

I have an airdrop script. I am currently making the part when it spawns automatically.

I have the airdrop model in ReplicatedStorage. I clone the part in the script, and set the position randomly.

The part spawns in the Workspace, but its position isn't set to a random position. The position is the exact position that the model is at.

Here is the Server Script:

local radcash = math.random(1000, 5000)

local part = game.ReplicatedStorage.DropItem.drop

local radposx = (math.random(100.2, 320.8))

local radposz = (math.random(1.3334, 172.2))

while true do

wait(60)

local clonedDrop = part:Clone()

if clonedDrop then

local dropmodel = Instance.new("Model",workspace.Drops)

dropmodel.Name = "AirDrop"

clonedDrop.Parent = dropmodel

local xvalue = (clonedDrop.Position.X)

if xvalue then

local zvalue = (clonedDrop.Position.Z)

if yvalue then

xvalue = Vector3.new(radposx)

yvalue = Vector3.new(radposz)

clonedDrop.Position.Y = Vector3.new(2.29)

end

end

end

end

Any help?

1 answer

Log in to vote
0
Answered by
megukoo 877 Moderation Voter
5 years ago

When you use math.random() to define radposx and radposz, you define it once and it never changes again.

To fix it, you simply need to place both of them inside your loop. Hope this helps!

0
It still has the same position every time. Sorry to say but it's true. toman655 58 — 5y
Ad

Answer this question