As in Catching Fire when you get hurt a blood puddle forms until the map clears I want that but I want it so it goes away after 1 minute.
First of all create a localscript and put it in the player, once you've done that set up an anonymous function to fire when the humanoid takes damage.
local hum = script.Parent.Humanoid local LastHealth = hum.Health local maxSize = 5 -- Determines the maximum size of the blood pool script.Parent.Humanoid.HealthChanged:connect(function(Health) local change = math.abs(LastHealth - Health) -- this will let us create a bloodpool proportional to the change ofHealth if LastHealth > Health then local Pool = Instance.new("Part", game.Workspace) -- creates the new part and sets it's values Pool.Anchored = false Pool.BrickColor = BrickColor.new("Bright red") Pool.FormFactor = "Custom" Pool.Size = Vector3.new((change/hum.MaxHealth)*maxSize, 0.2, (change/hum.MaxHealth)*maxSize) --Defined maxSize on Line 3 of the script, make it what ever you want. Pool.TopSurface = "Smooth" Pool.BottomSurface = "Smooth" Pool.CFrame = CFrame.new() + script.Parent.Torso.CFrame * Vector3.new(0, -3, 0) -- should place it below the players feet. --Optional add a mesh here to make it round. Pool.CanCollide = false; Pool.Touched:connect(function(hit) if not hit.Parent:FindFirstChild("Humanoid") then Pool.Anchored = true end end) Spawn(function() -- spawns this function on a separate thread so it doesn't stall this one wait(60) Pool:Destroy() -- destroys the pool after 60 seconds. end) end LastHealth = Health -- sets LastHealth to Health so that next time the script runs change can be calculated correctly end)
Try this out and see if it works :).
To make this work for all players add a script to the workspace, then add a localscript to that script with the disabled property checked. Add the above code to the localscript.
In the script use this code
game.Players.ChildAdded:connect(function(Player) -- fires when a player joins the game Player.CharacterAdded:connect(function(Character) -- fires when it's character is added local poolScript = script.LocalScript:Clone() -- clones the localscript poolScript.Parent = Character -- parents it to the character poolScript.Disabled = false -- enables it end) end)
What this will do is clone the localscript containing the pool code into each of the players characters when they join the game and whenever they respawn.
EDIT: So I've compiled the localscript at the top for you, it's in one part now.
Layout in Explorer: Workspace -Script (2nd codeblock goes here) --LocalScript (1st codeblock goes here)
When you script this, it would be a good idea to make it a function, then you can just call it every time someone dies :3
PS, i also play catching fire x3
Closed as Not Constructive by evaera
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?