Hello devs! i was going to have a script that use mouse. how can i get it from a script?
script:
local ms = require(game.ReplicatedStorage.FightingStyles.Sumo)
script.Parent.RemoteEvent.OnServerEvent:Connect(function(plr,key)
local chr = plr.Character
if ms[key] then
ms[key] (plr)
end
end)
script.Parent.Unequipped:Connect(function()
local plr = script.Parent.Parent.Parent
if plr.Character:HasTag(“Block”) then
ms.FF(plr)
end
end)
module:
local hb = require(game.ReplicatedStorage.Modules.Hitbox)
local hb2 = require(game.ReplicatedStorage.Modules.HitboxI)
local module = {}
module.F = function(plr)
local chr = plr.Character
if chr:HasTag(“InMove”) then
return
end
if chr:HasTag(“Stun”) then
return
end
task.spawn(function()
local sfx = game.ReplicatedStorage.Assets.Weapons.SoulCane.Sounds.Block:Clone()
sfx.Parent = chr
sfx:Play()
game.Debris:AddItem(sfx,sfx.TimeLength)
chr.HumanoidRootPart.Attachment1.Block.Enabled = true
chr:AddTag(“InMove”)
plr.Character:AddTag(“Block”)
plr.Character.Humanoid:LoadAnimation(game.ReplicatedStorage.Assets.Weapons.SoulCane.Animations.Block):Play()
end)
end
3 Likes
Do you mean use the mouse as in try to make something happen based off of mouse input?
I would get started with game.Players.LocalPlayer:GetMouse()
1 Like
ok but its a server script. so i can use players.localplayer
1 Like
If you require a module script from the client, you are basically working on client in that module script. Same goes from the server. If you want to get the Player from a local module, you’d just use game.Players.LocalPlayer. If you are working on server it depends on how and wherefor you are using the module.
For instance, if you use it for when a Player joins, you use the parameter Player of the PlayerAdded event found at Players. Usually you want to pass through the Player with your functions.
Hope this helps you.
1 Like
ok but taht does not work
module :
module.R = function()
local plr = game.Players.LocalPlayer
print(plr.Name)
end
error:
17:02:29.222 ReplicatedStorage.FightingStyles.JJSCM:253: attempt to index nil with ‘GetMouse’ - Server - JJSCM:253
17:02:29.222 Stack Begin - Studio
17:02:29.222 Script ‘ReplicatedStorage.FightingStyles.JJSCM’, Line 253 - Studio - JJSCM:253
17:02:29.222 Script ‘Players.Guest85851592.Backpack.Jujutsu Curse Manipulation.Script’, Line 7 - Studio - Script:7
17:02:29.222 Stack End - Studio
3 Likes
“ReplicatedStorage.FightingStyles.JJSCM:253: attempt to index nil with ‘GetMouse’ - Server - JJSCM:253”
As you are not giving us any code to look at, look at the documentation. It is not very hard, just read.
1 Like
sorry local script:
local eq = false
game.UserInputService.InputBegan:Connect(function(key,gpe)
if gpe then
return
end
if eq == false then
return
end
script.Parent.RemoteEvent:FireServer(key.KeyCode.Name,“b”)
if key.UserInputType == Enum.UserInputType.MouseButton1 then
script.Parent.RemoteEvent:FireServer(“M1”)
end
end)
game.UserInputService.InputEnded:Connect(function(key,gpe)
if gpe then
return
end
if eq == false then
return
end
script.Parent.RemoteEvent:FireServer(key.KeyCode.Name…key.KeyCode.Name)
end)
script:
local ms = require(game.ReplicatedStorage.FightingStyles.JJSCM)
script.Parent.RemoteEvent.OnServerEvent:Connect(function(plr,key)
local chr = plr.Character
if ms[key] then
ms[key](plr)
end
end)
script.Parent.Unequipped:Connect(function()
local plr = script.Parent.Parent.Parent
if plr.Character:HasTag(“Block”) then
ms.FF(plr)
end
end)

2 Likes
This is clearly not where your error is at.
1 Like
what? i gave you all the 3 scripts that i use.
1 Like
It says line 253. But anyways, I gave you all information you needed, (once again this documentation), and with that you should be able to fix it.
1 Like
i checked the documentation for the second time. and i dont see any fix
1 Like
the way i do get the module is i send the key via remote from local script, server script gets the remote and uses the key on the remote event to use it on module[key] (plr) so i can both get key and player while making the the thing on server
1 Like