Highlight Script Not working

which line of the code is this error located at?

glow.FillTransparency.Value += .01

FillTransparency is a property, not a ValueBase.

glow.FillTransparency += .01

Yes.

1 Like

The error is at line 7. I’m not sure what’s wrong.

How would I fix this?? Would I delete the .Value?

use @HugeCoolboy2007 's advice, delete the value your indexing.

1 Like

Wait, there’s another problem!!! It won’t turn back once I hit it.

If I hit it with my sword when I’m not swinging It turns on.

you’re just using a touched event, i’m pretty sure your script doesn’t detect swinging.

Should I used a tool.activated? Or would I need to use bool value???

you would need to use tool.activated to actually make the bool value true / false. you would still need to use the touched event to detect collision

So I should just use a combination of both.

Really weird but the NPC stays red in studio. Is this a bug?

yes, set up the bool value. use tool.activated to turn the bool value true / false with a debounce. then in the touched event, check if the bool is true, then do all the other stuff.

Wait, would I need a bool value or could I do something like my debounce variable: debounce = false

FillTransparency doesnt need .Value
Fixed:

local function light(hrp) --Highlights the hrp
	local highlight = hrp.Highlight
	for i = 0,600,1 do
		highlight.FillTransparency -= .01
	end
	for i = 0,600,1 do
		highlight.FillTransparency += .01
	end
end
1 Like

I have 2 more issues. The highlight thingy works but:

  1. It stays red in studio

  2. It cant be damaged while its highlighted.

I did not know how difficult this would be… :sick:

Can I see the full script to resolve the second issue?
For the first issue, send a video of what you mean.

Here’s a picture of what happens:

image

It stays like this forever…

For this to happen I need to hit the NPC with my sword and exit while the NPC is red.

Here’s my script. :slight_smile:

local debounce = false
local hitting = false
local tool = script.Parent.Parent
local Debris = game:GetService("Debris")

local function light(glow) --Highlights the hrp
	for i = 0,50,1 do
		glow.FillTransparency -= .01
		task.wait(0.00000000000000000000000001)
	end
	print("End")
	for i = 0,50,1 do
		glow.FillTransparency += .01
		task.wait(0.00000000000000000000000001)
	end
	print("Done")
end

tool.Activated:Connect(function(attack)
	hitting = true
	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 glow = hit.Parent.glow
			debounce = true
			print(glow)
			humanoid:TakeDamage(15)
			local Creator_Tag = Instance.new("ObjectValue")
			Creator_Tag.Name = "creator"
			Creator_Tag.Value = script.Parent.Parent.Parent
			Debris:AddItem(Creator_Tag, 2)
			Creator_Tag.Parent = humanoid
			light(glow)
		end
		task.wait(1) -- Change this to how much time the cooldown will take
		debounce = false
	end)
	hitting = false
end)