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

Is there a way to improve this?

Asked by
neoG457 315 Moderation Voter
9 years ago
storage = game.ReplicatedStorage
backpack = game.Players.LocalPlayer.Backpack
math.randomseed(tick())

storage["Kagune" .. tostring(math.random(8))]:clone().Parent = backpack

This script randomly clones a script in Replicated Storage and put it in your backpack

It works but it seems to base the randomisation on timezones for example: If two people lived in Europe they'd get the same script however I want it to be completely random, help me improve this?

1
you making a Tokyo Ghoul type of thing? OniiCh_n 410 — 9y
0
Yep neoG457 315 — 9y

1 answer

Log in to vote
1
Answered by
OniiCh_n 410 Moderation Voter
9 years ago

Assuming the Kagunes are placed in the root ReplicatedStorage by itself, you can do this.

storage = game:GetService("ReplicatedStorage")
backpack = game.Players.LocalPlayer.Backpack
--not sure why you had the tick, cause you didn' really use it in the provided script. if you used it for something else, you can add it back in.

local kagunes = storage:GetChildren()

local newkagune = storage["Kagune" .. tostring(math.random(1, #kagunes))]:clone()
newkagune.Parent = backpack
0
Thanks, I had to change "#kagunes" to the maximum amount of kagunes I had in storage neoG457 315 — 9y
Ad

Answer this question