You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
Highlight a part in neon green when the mouse hovers to it. -
What is the issue? Include screenshots / videos if possible!
At first hover, it seems to work but as soon as I unhover and hover again it does not seem to highlight anymore -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
It worked just a second ago but as soon as I added a keycode input into it, it stopped working, I then tried to remove the keycode input in the script and reverted it back to what it originally was, but it seems to stop working
local ui = game:GetService("UserInputService")
local rs = game:GetService("ReplicatedStorage")
local event = rs:FindFirstChild("Pickup")
local playr = game:GetService("Players").LocalPlayer
local char = playr.CharacterAdded:Wait()
local mouse = playr:GetMouse()
local obj = nil
local prevobj = nil
--game["Run Service"].RenderStepped:connect(function()
local db = false
ui.InputChanged:Connect(function()
if mouse.Target then
obj = mouse.Target
-- local dist = (char.HumanoidRootPart.Position - mouse.Target.Position).magnitude
if obj:FindFirstChild("Pickable") and obj.Name == obj.Name then
--if dist <= 10 then
if db == false then
db = true
print(obj.Name)
if not playr.PlayerGui.Pick.ViewportFrame:FindFirstChild("Replicate") then
local clone = obj:Clone()
clone.Parent = playr.PlayerGui.Pick.ViewportFrame
clone.CFrame = obj.CFrame
clone.Name = 'Replicate'
end
if not obj:FindFirstChild("dummy") then
local dummy = obj:Clone()
if dummy.ClassName == 'UnionOperation' then
dummy.UsePartColor = true
dummy.Name = 'dummy'
dummy.Parent = obj
dummy.Material = Enum.Material.Neon
dummy.CFrame = obj.CFrame
dummy.Position = obj.Position
dummy.Color = Color3.fromRGB(0, 255, 0)
obj.Transparency = 1
else
dummy.Name = 'dummy'
dummy.Parent = obj
dummy.Material = Enum.Material.Neon
dummy.CFrame = obj.CFrame
dummy.Position = obj.Position
dummy.Color = Color3.fromRGB(0, 255, 0)
obj.Transparency = 1
end
end
playr.PlayerGui.Pick.ViewportFrame.CurrentCamera = workspace.CurrentCamera
playr.PlayerGui.Pick.ViewportFrame.ImageTransparency = 0
if obj ~= prevobj then
prevobj = obj
end
end
else
if obj ~= prevobj and obj.Name ~= "Tool" and prevobj ~= nil then
if not obj:FindFirstChild("Pickable") then
if prevobj.dummy ~= nil then
prevobj.dummy:Destroy()
prevobj.Transparency = 0
playr.PlayerGui.Pick.ViewportFrame:FindFirstChild("Replicate"):Destroy()
prevobj = nil
print(obj.Name)
end
end
end
end
end
end)
--end)