chances = {
['FuelCrate'] = 85,
['HealthCrate'] = 15,
}
script.Parent.Spawn.OnServerEvent:connect(function()
local sum = 0
for thing, chance in pairs(chances) do
sum = sum + chance
end
local index = math.random() * sum
local choice
for thing, chance in pairs(chances) do
index = index - chance
if index <= 0 then
choice = thing
break
end
end
local spawnedLoot = game.ReplicatedStorage.Loot[choice]:Clone()
spawnedLoot.Parent = workspace
spawnedLoot:MoveTo(script.Parent.Position)
--Code for rotating goes here
end)
Title; The reason is that i dont know exactly how to do this kind of rotation (ive only use CFrame.Angles once), and im afraid ill break something if I do it myself, so i'd like some help from people more experienced on CFrame.
The reason I need to rotate it is that it always spawns in the same direction, so it might cause certain loot types to appear to be empty then they're full, blend in with the structures etc.
