When I enable a highlight in a local script, It shows up on all players devices, I don’t understand?
code
function use()
for i, child in ipairs(game.Workspace.RopeConnectors:GetChildren()) do
child.Highlight.Enabled = true
end
end
local function drop(plr)
for i, child in ipairs(game.Workspace.RopeConnectors:GetChildren()) do
child.Highlight.Enabled = false
end
end
script.Parent.Unequipped:Connect(drop)
script.Parent.Equipped:Connect(use)
2 Likes
I guess I could change the part’s color, but it would not be visible through objects.
I could use a surface GUI then make be AlwaysOnTop, but that would not be the same.
I tested this out, it seems to be just a studio only visual glitch. The effects shouldn’t be seen in a live server but nevertheless it is still a studio bug so I shall report it
I tested it out in a server, and it worked, but I found another problem, In a tool, I have a script, when equipped, all players should have a highlight, but I am the only player,= who has it on, the dev console says that the highlight is on in the other player, but I am not seeing anything, prints everything it should. code-
task.wait(5)
script.Target.Value = script.Parent.Parent:WaitForChild("Backpack"):WaitForChild("Camera")
function Enabled()
print("enabled")
for i, child in ipairs(game.Players:GetChildren()) do
print(child.Name)
for i, part in ipairs(child.Character:GetChildren()) do
print("found "..child.Name)
if not part:FindFirstChild("Highlight") then
local outline = Instance.new("Highlight")
outline.FillTransparency = 1
outline.OutlineTransparency = 0
outline.OutlineColor = Color3.fromRGB(0, 255, 0)
outline.Parent = part
end
if part:FindFirstChild("Highlight") then
print("highlight on in "..part.Parent.Name)
part.Highlight.Enabled = true
end
end
end
end
local function Unenabled()
for i, childs in ipairs(game.Players:GetChildren()) do
for i, parts in ipairs(childs.Character:GetChildren()) do
if parts:FindFirstChild("Highlight") then
parts.Highlight.Enabled = false
end
end
end
end
script.Target.Value.Unequipped:Connect(Unenabled)
script.Target.Value.Equipped:Connect(Enabled)
print(script.Target.Value)
1 Like
You could try this
local Tool = script.Parent
function Enabled()
for _,v in game:GetService("Players"):GetPlayers() do
if not v.Character then return end
if not v.Character:FindFirstChildOfClass("Highlight") then
local Outline = Instance.new("Highlight")
Outline.FillTransparency = 1
Outline.OutlineTransparency = 0
Outline.OutlineColor = Color3.fromRGB(0, 255, 0)
Outline.Parent = v.Character
else
v.Character:FindFirstChildOfClass("Highlight").Enabled = true
end
end
end
function Unenabled()
for _,v in game:GetService("Players"):GetPlayers() do
if not v.Character and not v.Character:FindFirstChildOfClass("Highlight") then return end
v.Character:FindFirstChildOfClass("Highlight").Enabled = false
end
end
Tool.Unequipped:Connect(Unenabled)
Tool.Equipped:Connect(Enabled)
But isn’t my script the same thing almost?