print(“Hello developers!”)
Currently, Roblox ClickDetectors are mostly seen as obsolete in favour of the newer addition to Roblox - ProximityPropmts. That’s no surprise - ProximityPrompts offer more customisation and more flexibility in scripts.
Imagine a ClickDetector reinvented.
My idea of a click detector is that it should have a built in choice to highlight the object that it is parented to and this is what inspired me to create this script. Not only does it add a highlight to the object your mouse is hovering over it also lets you add an ActionText! Simply add a custom property of string to the ClickDetector called ActionText and input the text you wish to be displayed.
Amazing! Can bring alot of life to a game. One quick addition i did is adding this into the top of the script:
local localplayer = game.Players.LocalPlayer
RunService.RenderStepped:Connect(function()
local HitPos = Mouse.Hit.Position
if Mouse.Target:FindFirstChildWhichIsA("ClickDetector") and localplayer:DistanceFromCharacter(HitPos) <= Mouse.Target:FindFirstChildWhichIsA("ClickDetector").MaxActivationDistance then
Makes the outline only appear when the player is within the MaxActivationDistance of the clickdetector!
I should’ve put it in a pcall() and do some error handling, how it originated is that I was bored and had no idea what to make so I speedran a module, I’ll fix that
I put the StringValue under a part and named it ActionText, put some Text in the Value Property and nothing shows up when I hover over the part it in-game.
The reason I’m mentioning the new Fonts update is because not only did all the fonts get renamed, the newer fonts aren’t supported at all. I tried changing the TextLabel.FontFace = "Code" to the new TextLabel.FontFace = Font.new("rbxassetid://12187373327") and it still wouldn’t show up.
Also is support for MaxActivationDistance going to be added? You can hover over it and it’ll still appear from any distance.