#It works fine in studio, but it doesnt work in Rblx
1 messages · Page 1 of 1 (latest)
try using a click detector and using clickDetector.MouseHoverEnter
local part = script.Parent
local clickDetector = Instance.new("ClickDetector")
clickDetector.Parent = part
clickDetector.MouseHoverEnter:Connect(function(player)
print(player.Name .. " is hovering over the part")
part.Color = Color3.fromRGB(0, 255, 0) -- turns green
end)
clickDetector.MouseHoverLeave:Connect(function(player)
print(player.Name .. " stopped hovering")
part.Color = Color3.fromRGB(255, 0, 0) -- turns red
end)
like this
just keep a highlight in replicated storage to clone it or something
or do highlight:Destroy() on .MouseHoverLeave with Instance.new()
idk if its the issue, but Enum.RaycastFilterType.Blacklist is depricated, u need to use .Exclude
Why would he use a module in this 😔
To make it work in other scripts and not in one so the module itself handles other raycastparams
Yes, but in this specific circumstance, it doesn't seem like it'll need to be referenced through multiple scripts
you forgot to press publish
true but what if there is multiple different type of lua rayCast.FilterDescendantsInstance = {types}
since there will be other types u can filter out
Wdym
If he needs to add more things to the filter, he can just add more to the table
instead of that why not module it to add its direct filter list so u dont have to worry about the one long table
I think there's just something with how you're wording it that I'm not understanding lol
where u can keep track of all Filter types```lua
export type Filter = {
Add: (self: Filter, instances: {Instances}) -> (),
Remove: (self: Filter, instance: {Instance}) -> (),
}
local Filter = {}
Filter.__index = Filter
function Filter.new(filterType: 'Exclude'|'Include'): Filter
local self = {}
self.Params = RaycastParams.new()
self.Params.FilterType = filterType or Enum.RaycastFilterType.Exclude
self.Params.FilterDescendantsInstances = {}
return setmetatable(self, Filter)
end
function FIlter:Add(instances: {Instances})
for _, ins in ipairs(instances) do
table.insert(self.Params.FilterDescendantsInstances, ins)
end
end
function Filter:Remove(instances: {Instance})
local set = {}
for _, inst in ipairs(instances) do
set[inst] = true
end
local newList = {}
for _, inst in ipairs(self.Params.FilterDescendantsInstances) do
if not set[inst] then
table.insert(newList, inst)
end
end
self.Params.FilterDescendantsInstances = newList
end
function Filter:SetType(filterType: Enum.RaycastFilterType)
self.Params.FilterType = Filter
end
function Filter:GetParams(): RaycastParams
return self.Params
end
return Filter```
Oh, I see where you're getting at now
i know its kinda confusing at first
** You are now Level 10! **
For the person posting the problem, though, I still don't think it's necessary unless they're planning on doing a lot more with the filter than what is currently being shown
yep thats just what i would use for what ill be doing for what ill have
but u would be able to add on to it and much more