I’ve been diving into module scripts and I know that its depended on the script that requires it whether its going to be on the server or client but I would like it to be on the server. However, you cannot use **UserInputService **on a server script so everything that happens will be on the client and I can’t figure a way around this. Could anyone help?
LocalScript:
local GameFolder = game.ReplicatedStorage.GameFolder
local Modules = GameFolder.Modules
local PearlModule = require(Modules.PearlAbilities)
local Debounce = true
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(hit, chat)
if chat then return end
local ActivateAbility = PearlModule[hit.KeyCode]
if ActivateAbility and Debounce == true then
local Cooldown = ActivateAbility.Cooldown
Debounce = false
ActivateAbility.Activate()
wait(Cooldown)
Debounce = true
end
end)
ModuleScript:
local TweenService = game:GetService("TweenService")
local Players = game.Players
local Cooldown = nil
local Abilitys = {
[Enum.KeyCode.Q] = {
Activate = function(Player)
local Character = Players.LocalPlayer.Character
local Gem = Character:WaitForChild("Gem")
if Gem.Light.Brightness == 0 then
Gem.Material = Enum.Material.Neon
TweenService:Create(Gem.Light,TweenInfo.new(1), {Brightness = 10} ):Play()
else
Gem.Material = Enum.Material.SmoothPlastic
TweenService:Create(Gem.Light,TweenInfo.new(0.5), {Brightness = 0} ):Play()
end
end,
Cooldown = 1.1
},
[Enum.KeyCode.F] = {
Activate = function(Player)
local Character = Players.LocalPlayer.Character
local Humanoid = Character:WaitForChild("Humanoid")
local Health = Humanoid.Health
local MaxHealth = Humanoid.MaxHealth
local timer = 15
print(Character.Name)
end,
Cooldown = 5
}
}
return Abilitys

2 comments
The reason why I want to be required on the server is because I want others to see when you use your abilities
In that case you should trigger a remote event telling the server that some ability was used, then have the server fire all clients so they can render the effects locally.