I’m not sure if this is an engine issue or what, but I have this x-ray ability in my game where players can use and it enables or disables highlights, and the thing is some of my players are saying that it isn’t working sometimes and then for other players I ask them if they’ve encountered any bugs and they have said no?
Here is the code, I have a strong feeling this is just an engine issue also I have the highlight inside of a model with all the parts that can be highlighted
Pretty much just focusing on the tween function where it enables or disables lights depending on the task, so basically if either task isn’t Active then no highlight will be enabled, the part the sometimes isnt working for some players is that when it is either task it’s just not working??
local Lighting = game:GetService("Lighting")
local module = {}
local LostItemsStorage = workspace.LostItems
local LostPanels = workspace.LostPanels
local spr = require(game.ReplicatedStorage.spr)
local FindSolarPanels = require(game.ReplicatedStorage.Tasks.FindSolarPanels)
local LostItems = require(game.ReplicatedStorage.Tasks.LostItems)
local function tween(n)
if FindSolarPanels:IsActive() then
if n < 0 then
LostPanels.Highlight.Enabled = true
else
LostPanels.Highlight.Enabled = false
end
elseif LostItems:IsActive() then
if n < 0 then
LostItemsStorage.Highlight.Enabled = true
else
LostItemsStorage.Highlight.Enabled = false
end
end
spr.target(Lighting, 10, 7, {
ExposureCompensation = n
})
end
function module.Usability(bool)
if not bool then
tween(0)
end
end
function module.InputBegan()
tween(-5)
end
function module.InputEnded()
tween(0)
end
return module
Yeah I feel like its an engine bug, but even though you might not be able to help me solve it do you think you could help me come up with a different method of using xray? Like a different way without having to use highlights?
Highlight objects dont work on mobile devices. this is a bug that is apparently being fixed although its been a issue for a couple years now bug report
Using 2 highlights per model seems excessive. You could easily merge them into one model and just use one highlight.
You can also temporarily move players that have their X-Ray turned on into a model with a singular highlight, so you can theoretically control hundreds of players with a single highlight instance. It all depends on your implementation.
I haven’t had any issues with highlights so far. In your case if you use X-ray on just 15 people you would have already reached your limit, not to mention potential other areas of your game that you might be using highlights for but haven’t mentioned.
Also keep in mind Client to Server communications, any highlights your create on the client will not replicate to other users. So highlights might not be properly replicating. If you’re creating highlights on the server disregard this last part.