So i cant get this remote event to trigger, this is one of my components on the server. The same setup works on client with a bindable event but on the server i get no response from the little print statement. It also works in a regular server script just not in this component module format. Is there a workaround i can try because i would like to keep this solution that i use on the client because its just so elegant for my use case
--COMPONENT TEMPLATE
-- SERVICES
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
-- SETTINGS
local SETTINGS = {
Tag = "LightTool",
}
-- DEFINE COMPONENT
local Component = {Tag = SETTINGS.Tag}
Component.__index = Component
-- PRIVATE VARIABLES
local ModuleLoader = require(ReplicatedStorage.ModuleLoader)
local ev_ToolAction = ReplicatedStorage.Event.Server.ToolAction
local rev_ToolActionRemote = ReplicatedStorage.Event.Remote.ToolActionRemote
-- CONSTRUCTOR
function Component.new(instance : instance)
local self = setmetatable({
["_initialized"] = false,
["Instance"] = instance,
["state"] = false,
}, Component)
self:_init()
return self
end
function Component:_init()
if self._initialized == true then return end
self._initialized = true
rev_ToolActionRemote.OnServerEvent:Connect(function(player,actionName, inputState, toolInstance, Target)
print("recieved rev on server", script.Name)
if inputState == "Begin" and toolInstance == self.Instance and actionName == "mouse1" then
self.state = not self.state
for _, child in self.Instance:GetDescendants() do
if child:isA("PointLight") or child:isA("ParticleEmitter") or child:isA("SurfaceLight") then
child.Enabled = self.state
end
end
end
end)
end
ReplicatedStorage:GetDescendants()
return Component