I am trying to make a highlight script that makes an NPC that you have hit with your sword gradually red and then slowly reverts back. I’ve never done this and my code is not working.
Script:
local function light(hrp) --Highlights the hrp
local highlight = hrp.Highlight
for i = 0,600,1 do
highlight.FillTransparency.Value -= .01
end
for i = 0,600,1 do
highlight.FillTransparency.Value += .01
end
end
esentially, you’re passing nil as the humanoidrootpart. to fix this, i’d need to see more of the script that shows how you’re passing the humanoidrootpart to the function
tool:WaitForChild("Handle").Touched:Connect(function(hit)
if debounce then return end
-- Will run if the item that touched the handle has a Humanoid
if hit.Parent:FindFirstChild("Humanoid") then
local humanoid = hit.Parent.Humanoid
local hrp = hit.Parent.HumanoidRootPart
Same error. I think this might be the issue but I don’t know what’s wrong.
local function light(glow) --Highlights the hrp
for i = 0,600,1 do
glow.FillTransparency.Value -= .01
task.wait(0.005)
end
for i = 0,600,1 do
glow.FillTransparency.Value += .01
task.wait(0.005)
end
end