Proximity Prompt Script not working

-- // Variables
-- / Main
local TS = game:GetService("TweenService")
local Button = script.Parent
local Highlight = Button.Highlight
local ProximityPrompt = Button.ProximityPrompt
-- / Tweening
local HighLightInfo = TweenInfo.new(0.35, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0)
local BeginProps = {OutlineTransparency = 0.125}
local EndProps = {OutlineTransparency = 1}
local HighLightBeginTween = TS:Create(Highlight, HighLightInfo, BeginProps)
local HighLightEndTween = TS:Create(Highlight, HighLightInfo, EndProps)
-- // Functions
-- / Proximity Prompt Functions
ProximityPrompt.PromptShown:Connect(function()
	
	print("Before Tween") -- Not Printing
	HighLightBeginTween:Play() -- Not Playing Tween
	print("After Tween") -- Not Printing
	
end)

ProximityPrompt.PromptHidden:Connect(function()
	
	print("Before Tween") -- Not Printing
	HighLightEndTween:Play() -- Not Playing Tween
	print("After Tween") -- Not Printing

end)

Workspace:
Workspace ScreenShot

I’m trying to make it so that the Highlight becomes visible once the prompt is shown, and disappear when it’s hidden.

(there are also no errors)

Any help is appreciated!

This event fires only on localscripts.

1 Like

I just switched the script to a local script, and it works perfectly! I didn’t know that it can only run on local scripts, thank you!

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