Help with Highlighting Parts when Proximity Prompt Shows

Hello for the past 15 mins I’ve been stuck on trying to solve this issue, what I am trying to achieve is that when a player gets near this block, it highlights, and when they go away it gets un highlighted, nothing is working and it doesn’t send a error message, the script is in side of the model in workspace and the game is single player so im not worried to much about client

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

-- Defined Variables
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvents = ReplicatedStorage:WaitForChild("RemoteEvents")
local Cube = script.Parent:WaitForChild("Cube")
local Proximity = script.Parent:WaitForChild("ProximityPrompt")

--

Proximity.PromptShown:Connect(function()
	local newHighlight = Instance.new("Highlight")
	newHighlight.Parent = Cube
	
	newHighlight.FillColor = Color3.new(0.341176, 0.466667, 0.705882)
	newHighlight.OutlineColor = Color3.new(0.0588235, 0.0588235, 0.0588235)
	
	print(" Showing Highlight ")
end)

Proximity.PromptHidden:Connect(function()
	local Highlight = Cube:FindFirstChild("Highlight")
	if Highlight then
		Highlight:Destroy()
	else
		print(" No Highlight Detected ")
	end
end)
1 Like

Does it work if you use a SelectionBox instead of Highlight

I do not know, but I am not gonna go through the troubles with a selection box, I just wanna use highlights only they look better and they are better for the purpose I am trying to achieve

Did you check in explorer to see if the highlight was actually added?

Yea, It wasnt added, dont know why

does this show anything in the output?

Also, is this a local script?

No, it does not, I’ve tried many ways to detect if the script works by things like printing not getting any result

Well, that doesn’t seem normal to me. I don’t know if PromptShown works on the server though, so is it on the client?

1 Like

Sorry for late reply but a few mins Atter u posted this I used a local script and it works

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