local Tool = script.Parent
local Equipped = false
local plr = game.Players.LocalPlayer
local Mouse = plr:GetMouse()
Mouse.TargetFilter = workspace:WaitForChild("RollerTopArea")
Tool.Equipped:Connect(function()
Equipped = true
Mouse.Icon = "rbxassetid://" .. 14438141291
-- 13361249528
end)
local RollerDebugUI = script.Parent:WaitForChild("RollerDebugUI")
Tool.Unequipped:Connect(function()
Equipped = false
Mouse.Icon = ""
if plr.PlayerGui:FindFirstChild("RollerDebugUI") then
plr.PlayerGui:FindFirstChild("RollerDebugUI"):Destroy()
end
end)
local RollerColors = {
["Common"] = Color3.fromRGB(85, 255, 91);
["Uncommon"] = Color3.fromRGB(69, 208, 74);
["Rare"] = Color3.fromRGB(29, 89, 255);
["Epic"] = Color3.fromRGB(114, 0, 171);
["Legendary"] = Color3.fromRGB(239, 184, 56);
["Mythic"] = Color3.fromRGB(255, 0, 0);
["Godly"] = Color3.fromRGB(255, 255, 127);
["Black Hole"] = Color3.fromRGB(17, 17, 17);
}
local RollerStorage = workspace:WaitForChild("RollerStorage")
while true do
if Equipped == true then
local Target = Mouse.Target
if Target and Target.Parent == workspace:WaitForChild("RollerStorage") then
local HL = Instance.new("Highlight")
HL.FillTransparency = 1
HL.Parent = Target
if plr.PlayerGui:FindFirstChild("RollerDebugUI") then
plr.PlayerGui:FindFirstChild("RollerDebugUI").Holder.Title.Text = Target.Name .. " Roller"
plr.PlayerGui:FindFirstChild("RollerDebugUI").Holder.Title.TextColor3 = RollerColors[Target.Name]
plr.PlayerGui:FindFirstChild("RollerDebugUI").Holder.RollerSpeed.Text = "Speed: " .. tostring(math.floor(Target.AssemblyLinearVelocity.Magnitude)) .. " studs/s"
plr.PlayerGui:FindFirstChild("RollerDebugUI").Holder.RollerDistToPlr.Text = "Dist: " .. tostring(math.floor(plr:DistanceFromCharacter(Target.Position))) .. "m"
else
local ClonedDebugUI = RollerDebugUI:Clone()
ClonedDebugUI.Parent = plr.PlayerGui
end
else
if plr.PlayerGui:FindFirstChild("RollerDebugUI") then
plr.PlayerGui:FindFirstChild("RollerDebugUI"):Destroy()
end
end
end
task.wait()
end
I made a radar gun to track the speed and distance to the ball but i cannot remove the highlight after
3 Likes
jadi20
(Jadi)
August 14, 2023, 10:31pm
2
I don’t see any references of the Highlight being removed as it is parented on the Target itself. Did you tried HL:Destroy()
? So far the Only thing I see you trying to delete is the RollerDebugUI
.
Yes I did try HL:Destroy() and there is a reference
jadi20
(Jadi)
August 14, 2023, 10:57pm
4
local Tool = script.Parent
local Equipped = false
local plr = game.Players.LocalPlayer
local Mouse = plr:GetMouse()
local HL
Mouse.TargetFilter = workspace:WaitForChild("RollerTopArea")
Tool.Equipped:Connect(function()
Equipped = true
Mouse.Icon = "rbxassetid://" .. 14438141291
-- 13361249528
end)
local RollerDebugUI = script.Parent:WaitForChild("RollerDebugUI")
Tool.Unequipped:Connect(function()
Equipped = false
Mouse.Icon = ""
if plr.PlayerGui:FindFirstChild("RollerDebugUI") then
plr.PlayerGui:FindFirstChild("RollerDebugUI"):Destroy()
HL:Destroy()
HL = nil
end
end)
local RollerColors = {
["Common"] = Color3.fromRGB(85, 255, 91);
["Uncommon"] = Color3.fromRGB(69, 208, 74);
["Rare"] = Color3.fromRGB(29, 89, 255);
["Epic"] = Color3.fromRGB(114, 0, 171);
["Legendary"] = Color3.fromRGB(239, 184, 56);
["Mythic"] = Color3.fromRGB(255, 0, 0);
["Godly"] = Color3.fromRGB(255, 255, 127);
["Black Hole"] = Color3.fromRGB(17, 17, 17);
}
local RollerStorage = workspace:WaitForChild("RollerStorage")
while true do
if Equipped == true then
print("e")
local Target = Mouse.Target
if Target and Target.Parent == workspace:WaitForChild("RollerStorage") then
if not HL then
HL = Instance.new("Highlight")
HL.FillTransparency = 1
HL.Parent = Target
end
if plr.PlayerGui:FindFirstChild("RollerDebugUI") then
plr.PlayerGui:FindFirstChild("RollerDebugUI").Holder.Title.Text = Target.Name .. " Roller"
print(RollerColors[Target.Name])
plr.PlayerGui:FindFirstChild("RollerDebugUI").Holder.Title.TextColor3 = RollerColors[Target.Name]
plr.PlayerGui:FindFirstChild("RollerDebugUI").Holder.RollerSpeed.Text = "Speed: " .. tostring(math.floor(Target.AssemblyLinearVelocity.Magnitude)) .. " studs/s"
plr.PlayerGui:FindFirstChild("RollerDebugUI").Holder.RollerDistToPlr.Text = "Dist: " .. tostring(math.floor(plr:DistanceFromCharacter(Target.Position))) .. "m"
else
local ClonedDebugUI = RollerDebugUI:Clone()
ClonedDebugUI.Parent = plr.PlayerGui
end
else
if plr.PlayerGui:FindFirstChild("RollerDebugUI") then
plr.PlayerGui:FindFirstChild("RollerDebugUI"):Destroy()
HL:Destroy()
HL = nil
end
end
end
task.wait()
end
jadi20
(Jadi)
August 14, 2023, 10:58pm
5
This should be the solution of the problem as you were creating multiple Highlights on the same Target.
I’ve tried your solution but it doesnt seem to work
jadi20
(Jadi)
August 15, 2023, 12:56am
8
Are you receiving any errors? On my side I got the system to work locally.
it doesnt remove the highlight for some reason
jadi20
(Jadi)
August 15, 2023, 4:19am
10
Can you Check if multiple Highlight instances are being created in the explorer when you select an object? As this was the issue with the script you sent me.
There were multiple instances but I fixed that but still wouldnt remove it
jadi20
(Jadi)
August 15, 2023, 1:25pm
12
So far it seems like your either not deleting it with HL:Destroy()
or Your not storing the Current Highlight properly. I cannot replicate the issue you have anymore as the solution I gave you fixed it on my end. You can see if this rbxl File help you think about if anything I have here is missing on your end.
RadarFix.rbxl (58.2 KB)