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

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

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

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!

1 comment

0

It still has the same position every time. Sorry to say but it's true.

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