I’ve been struggling with highlighting interactable object, when you hover your mouse over them, the script play both globally and on player’s client, the scripts are bellow:
local function onHoverEnter(player)
ColorShift:Play()
cPart.BrickColor = BrickColor.White()
end
local function onHoverLeave(player)
cPart.BrickColor = BrickColor.Gray()
end
cDetector.MouseHoverEnter:connect(HoverOn) -- Highlighting
cDetector.MouseHoverLeave:connect(HoverOff)
The above is a chunk of my code and I want to find a way to make it visible to the player who hover their mouse over it.
If you want to make it only client-sided, you could cast a ray every render step and then change the colour based on whether the part meets certain criteria.
--This is just an example , I made this quickly (ClientScript)
local RunService = Game:GetService("RunService")
local Players = Game:GetService("Players")
local player = Players.LocalPlayer
local Mouse = player:GetMouse()
local function onRenderStep()
if Mouse.Target then
-- change color
end
end
RunService.RenderStepped:Connect(onRenderStep)