Highlight Not Appearing when Player Equips Tool

Hi!

I have this gear that if you equip it, your character will have a highlight. I play-tested my game, gave myself the gear, but no highlight. Checked the Developer Console, no errors or warnings.

I believe that my LocalScript is somewhat of the problem, but I can’t be the one that can tell that since I’m getting back into coding on Roblox. Would anyone let me know what the issue is and potentially fixes that I can do?

Both ServerScript and LocalScript will be shown below.

ServerScript:

--// Variables
local Highlight = script.Highlight

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remotes = ReplicatedStorage:WaitForChild("Remotes")
local Remote = Remotes.SpecialTitleEquipped

--// Script
Remote.OnServerEvent:Connect(function(player, data)
	if data == "equipped" then
		local HighlightClone = Highlight:Clone()
		HighlightClone = player.Character
	elseif data == "unequipped" then
		local HighlightClone = player.Character:WaitForChild("Highlight")
		if HighlightClone.Parent == player.Character then
			HighlightClone:Destroy()
		end
	end
end)

LocalScript

--// Variables
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Tool = script.Parent

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remotes = ReplicatedStorage:WaitForChild("Remotes")

--// Script
Tool.Equipped:Connect(function()
	Remotes.SpecialTitleEquipped:FireServer("equipped")
end)
Tool.Unequipped:Connect(function()
	Remotes.SpecialTitleEquipped:FireServer("unequipped")
end)
2 Likes

Can you add some debugging statements on the ServerScript?, check if the remotevent its working correctly, if the highlight was cloned and whatnot.

I put for both Client & Server to double-check.
Says the highlight was added, but it didn’t get added, so there wasn’t any highlight to delete.

You aren’t setting HightlightClone’s parent to the character, instead you’re setting HighlightClone as the players character

I do want the highlight to be on the player who is equipping the tool.

Huh? Isn’t all you need in that case to set the Hightlight’s Parent to t he Character? Because all youre doing is trying to make the Highlight your Character, which does not really make much sense haha. Lmk if this helped and if that’s what u needed.

HighlightClone.Parent = player.Character

Ohh, I didn’t realize I didn’t need to have .Parent on my highlight…
I just tested it out, and it still didn’t seem to work.

what exactly is “HighlightClone”

It’s the clone of the Highlight that’s a child to the ServerScript.
It’s there so more than 1 person can have a highlight.

is it enabled? is the filltransparency < 1?

Hi so I just tried it out myself and it works for me. All I changed was 1 line feel free to try it out yourself.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remotes = ReplicatedStorage:WaitForChild("Remotes")
local Remote = Remotes.SpecialTitleEquipped

--// Script
Remote.OnServerEvent:Connect(function(player, data)
	print(data)
	if data == "equipped" then
		print("True")
		local HighlightClone = script.Highlight:Clone()
		HighlightClone.Parent = player.Character
	elseif data == "unequipped" then
		local HighlightClone = player.Character:WaitForChild("Highlight")
		if HighlightClone.Parent == player.Character then
			HighlightClone:Destroy()
		end
	end
end)```
3 Likes

It’s enabled and I have the outline property fully visible.
I even have it AlwaysOnTop.

All I needed was to remove the local Highlight = script.Highlight?
I am shocked, but this indeed fixed my script.

I’m glad I could help you! haha

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.