Hello so I have been trying to make a local highlight when the player hovers on a something, I tried using remote event and It doesn’t work or say any errors. Help would be appreciated
Server script:
local event = game.Workspace.RemoteEvents.HighlightEvent
local model = script.Parent.Highlight
script.Parent.MouseDetector.MouseHoverEnter:Connect(function(player)
event:FireClient(player, true)
end)
script.Parent.MouseDetector.MouseHoverLeave:Connect(function(player)
event:FireClient(player, false)
end)
Local script:
local event = game.Workspace.RemoteEvents.HighlightEvent
event.OnClientEvent:Connect(function(player, model)
if model then
model.Enabled = true
else
model.Enabled = false
end
end)
I’d start with some debugging on the client side,
stick this in then see what you get back:
Bit of adaptation:
local event = game.Workspace.RemoteEvents.HighlightEvent
local model = script.Parent.Highlight
script.Parent.MouseDetector.MouseHoverEnter:Connect(function(player)
event:FireClient(player, model, true)
end)
script.Parent.MouseDetector.MouseHoverLeave:Connect(function(player)
event:FireClient(player, model, false)
end)
local event = game.Workspace.RemoteEvents.HighlightEvent
event.OnClientEvent:Connect(function(player, model, enable)
print("Received event for player:", player)
print("Model:", model)
print("Enable:", enable)
if model then
model.Enabled = enable
end
end)
local event = game.Workspace.RemoteEvents.HighlightEvent
local model = script.Parent.Highlight
local target = 1
script.Parent.MouseDetector.MouseHoverEnter:Connect(function(player)
event:FireClient(player, model, target)
end)
script.Parent.MouseDetector.MouseHoverLeave:Connect(function(player)
event:FireClient(player, model, target)
end)
local script:
local event = game.Workspace.RemoteEvents.HighlightEvent
game.Workspace:WaitForChild("Testing")
local Targets = {game.Workspace.Testing:WaitForChild("Highlight")}
event.OnClientEvent:Connect(function(model, target)
if Targets[target].Enabled then
Targets[target].Enabled = false
else
Targets[target].Enabled = true
end
end)