I want to make a similar reward drop system to these games:
- Pet Simulator: Drops tokens around certain radius of the chest
- World Zero: Drops rewards after defeating the enemy
I notice that their rewards drop while standing upwards, levels with the ground and the parts aren’t collideable with the players atleast.
But my issue is that when I make mine the tokens are going through the ground. I tried body gyro but it only keeps them standing upwards, but goes through the ground cause it doesn’t collides with the ground (as I only want it to not collide with player).
Code:
local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
local RNG = Random.new():NextNumber(1, 2)
local EndAmount = math.random(3, 6);
local Radius = math.random(3,5);
local Circle = (math.pi * RNG);
for i = 1, EndAmount, 1 do
spawn(function()
local Clone = script.Token:Clone()
Clone.Position = HumanoidRootPart.Position
Clone.Parent = workspace
local Angle = ((Circle / EndAmount) * (i + RNG));
local x_pos = math.cos(Angle) * Radius;
local y_pos = math.sin(Angle) * Radius;
-- Falls to ground, rewards are distrubuted within the character radius.
local Tween = TweenService:Create(Clone, TweenInfos.SpawnInfo, {Position = HumanoidRootPart.Position + Vector3.new(x_pos, 0, y_pos)});
Tween:Play()
Tween.Completed:Wait()
-- Floats
local Tween2 = TweenService:Create(Clone, TweenInfos.FloatInfo, {Position = Clone.Position + Vector3.new(0, 1.5, 0)});
Tween2:Play()
end)
end