Help With Raining Candy

Hey Coldshot_Dev!

Can you supply us with a place file in rbxl format? This would allow us to troubleshoot and help you!

3 Likes

Heres a place file.
CandyGeneration.rbxl (22.1 KB)

:watermelon: Hiya!

Try using this code:

local candy = {}
	candy = game.ServerStorage.Candy
	candy.Parent = workspace
	candy.Position = Vector3.new(math.random(-120,120),100,math.random(-120,120))
	candy:Clone()
end

Please note Im on a chromebook so I have not tested this code. Please keep me updated on what happens.

Try switching the parent to workspace and making sure the properties are set right.

Hey, are you using a LocalScript? These are not able to see stuff in ServerStorage.
LocalScripts dont have access to the ServerStorage.

No, if you read posts above, I said I didn’t use a LocalScript.

Hey Coldshot_Dev!

I figured out your issue below:

for i = 1,100 do
	local candy = game:GetService("ServerStorage"):WaitForChild("Candy"):Clone()
	candy.Position = Vector3.new(math.random(-120,120),100,math.random(-120,120))
	candy.Parent = workspace
end

If you look, you did not clone the candy piece before you took it and positioned it and once one piece was generated, it was missing! This code can replace your server code.

1 Like

Also, if another script is interfering as @ExcessEnergy mentioned, make the data table that remakes the part before the player joins and then set the CanColide to false, transparency to 0 and change this back once you declare the event.

1 Like

The candy seems to now all form into one, which gives you 100 if you touch it. Instead of having 100 different ones that each give you 1.

Hey Coldshot_Dev!

I will be giving my edited place file below! Hope this helps:
CandyGeneration.rbxl (22.6 KB)

Can you go deeper on what you mean?

Your edited version seems to have all the candies frozen mid-air.

Theres just 1 candy that on touch gives 100.

Use candy.Anchored = false. Or make sure that the candy is not anchored.

I need to see the rest of youre code.

The candy isn’t anchored.
image

What’s the issue here? I’m a bit confused.

Try using this code:

local candy = {}
	candy = game:GetService(¨ServerStorage¨):WaitForChild(¨Candy¨):Clone()
	candy.Parent = workspace
	candy.Position = Vector3.new(math.random(-120,120),100,math.random(-120,120))
	candy:Clone()
end

Hey Coldshot_Dev!

My bad, I accidentally welded it to the baseplate. Destroy the weld shown below:

image

Hope this helps!

How is it even welded to the baseplate in the first place?