#replicated storage thing
1 messages · Page 1 of 1 (latest)
could you send a picture of the script you are using to clone the blocks as well as the script the blocks have?
also you want to avoid making a new script per block, you can use a modular script since all of those clones will have the same code
My brother is gatekeeping the PC rn so maybe soon
this is the spawn script which is a local script in starter player scritps
this is the script inside the common block that spawns
thats your problem, spawning something on the client side doesnt make it show up on the server
move this local script to a script (white) or a modular script (purple) and put it in serverscriptservice
and im guessing the contents of that script are meant for everyone in the game, instead of doing player.localplayer do a for loop of every player in the server instead
its meant for each player though
different for each person
you are waiting until a player has 100 value right?
yeah
and that player that reaches 100 value will get their own stuff
so there isn't infinite blocks spawned at once
yea i ment that but i explained it poorly
imma make some code off the top of my memory
local players = game.players
for _,player in players:getchildren() do
function(player)
end
** You are now Level 3! **
ah ok
let me just open studio actually
ideally it would be a modular script
@viscid wraith does this make sense?
not really
could you copy paste the code into the chat and ill rewrite it
local SpawnSpeed = 0.75
for _,player in players:GetChildren() do
while task.wait(SpawnSpeed) do
if game.Players.LocalPlayer:FindFirstChild("leaderstats").Spawned.Value == 100 then
task.wait()
else
if math.random(6) == 6 then
-- uncommon ig
game.Players.LocalPlayer:FindFirstChild("leaderstats").Spawned.Value = game.Players.LocalPlayer:FindFirstChild("leaderstats").Spawned.Value + 1
print("UnCommon")
NewUnCommon = game.ReplicatedStorage.Blocks.All.UnCommon:Clone()
NewUnCommon.Parent = game.Workspace
NewUnCommon.Position = Vector3.new(2.5-math.random(98), 2.5, -48.5+math.random(98))
else
--common
game.Players.LocalPlayer:FindFirstChild("leaderstats").Spawned.Value = game.Players.LocalPlayer:FindFirstChild("leaderstats").Spawned.Value + 1
print("Common")
NewCommon = game.ReplicatedStorage.Blocks.All.Common:Clone()
NewCommon.Parent = game.Workspace
NewCommon.Position = Vector3.new(2.5-math.random(98), 2.5, -48.5+math.random(98))
end
end
end
end ```
basically you are getting the list of players from the server
oh woops i forgot should probably make it a task.spawn
and then from that list of players, you will go through each person and have them put through the function
i dont know if the red helps
but it starts off at 1 and then goes to 2
the difference between your currect script and the screenshot is that the game.players.localplayer is replaced with the player variable that was given from the loop in #1
because game.players.localplayer is only avaliable for client side scripts
also since line 12 and 19 are the same thing
you can just move it outside the second if statement
i alr did that
player:FindFirstChild("leaderstats").Spawned.Value += 1
you can also do this instead of repeating the spawned.value thing again
+= basically means add whatever value is after the sign to the variable before the sign
i changed it and it isn't spawning blocks or giving errors
you moved it from a local script to a server script right?
yes
perhaps it has something to do with the clone
i did notice there was no declaring of your variable NewUnCommon and NewCommon
did you make that global somewhere?
no
i wonder why urs isnt underlined then
also the variable is a clone
underneath the first else
put in local Clone
and then replace NewUnCommon and NewCommon with Clone (the variable name)
like this?
yea
** You are now Level 4! **
its not working still
weird
ah wait
i think i know
classic
the script is loaded before the player actually joins
of course
is that script ment to be always running?
yeah
ok then instead of the for loop
test is the function name
or this
probably should do this one ^
thanks it works now 🙏