Hi. First off, I'm just messing around with the code of someone else's work to help get a better understanding of how it works so I can make my own version without stealing all there code. I would like to make it so that the blood particles that spawn, spawn randomly on different limbs. It normally just spawns on the torso which looks weird.
I tried to use math.random to make a random value, but I want more than 2 arguments, is there some function that can do that? I'm not aware of it and I'm pretty new to coding.
I think I understand what you mean, you want to get a number of parts randomly to insert the fx? This can go in StarterCharacterScripts as a LocalScript. Next time include some code, normally people won't help otherwise.
local player = game.Players.LocalPlayer local character = player.Character local humanoid = character:WaitForChild("Humanoid") local limbs_to_affect = 3 math.randomseed(tick()) -- you need to randomize the randomizer local function random_limbs() local parts = {} -- table to store limbs for i,v in pairs(character:GetChildren()) do local part = v:IsA("BasePart") -- Is part a part? if part then -- If so insert into parts table table.insert(parts, v) -- (table, index or 1 on default, value) end end repeat table.remove (parts, math.random(#parts) ) wait() until #parts == limbs_to_affect -- will error if there aren't enough limbs, write an upgrade return parts end humanoid.Died:Connect(function() for i,v in pairs( random_limbs() ) do -- loop through our limbs table Instance.new('Fire', v ) -- parent fx to part end end)