So im making a game and i need a script for when your character is damaged on a body part and when it gets damaged a blood decal or just a decal pops up on the body part that was damged please help!
This website isn't for giving out free scripts, but here are the building blocks.
you want to detect if the player's health changed here's the article: https://developer.roblox.com/en-us/api-reference/event/Humanoid/HealthChanged
basically, the code from there is (make sure its in a local script or whatever)
local char = game.Players.LocalPlayer.Character local humanoid = char:WaitForChild("Humanoid") humanoid.HealthChanged:Connect(function(health) end)
then you want to Instance a decal onto there
local char = game.Players.LocalPlayer.Character local humanoid = char:WaitForChild("Humanoid") local Texture = "http://www.roblox.com/asset/?id=4019275819" humanoid.HealthChanged:Connect(function(health) local decal = Instance.new("Decal",char.UpperTorso) -- if your game is r6 replace UpperTorso with Torso decal.Texture = Texture end)
There you have it, when a player's health is damaged there will be a decal instanced onto it, don't forget to put in a assetid. (Btw, I assumed you were referring to blood instanced on the body so I already put on a blood id onto there, and here's a script if you want it to disappear after any amount of seconds just edit the variable called wait).
local char = game.Players.LocalPlayer.Character local humanoid = char:WaitForChild("Humanoid") local Texture = "http://www.roblox.com/asset/?id=4019275819" local wait = 3 humanoid.HealthChanged:Connect(function(health) local decal = Instance.new("Decal",char.UpperTorso) -- if your game is r6 replace UpperTorso with Torso decal.Texture = Texture wait(wait) decal:Destroy() end)