RemoteEvents Script Support Needed

How do I transfer the players mouse through the remotevent so I can access it in a server script? I didn’t add any code cause I thought it wasn’t necessary but ask me if you want it.

What do you want to do with the mouse? Like getting a position of the mouse?

On the local script I am firing the event when ever somebody clicks a tool and the animation plays, then I am trying to code on the server script so when you have your mouse over a part it will give you +1 point. I can you the code. So i am using mouse.Target with it

w
--LOCALSCRIPT
local stonePickaxe = script.Parent
local debounce = false
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

stonePickaxe.Activated:Connect(function()
	if not debounce then
		print("Pickaxe was clicked")
		debounce = true
		game.ReplicatedStorage.RemoteEvents.PickaxeEvent:FireServer()
		

		local Character = stonePickaxe.Parent
		local Humanoid = Character.Humanoid
		local Animation = stonePickaxe.Animation

		local AnimationTrack = Humanoid:WaitForChild("Animator"):LoadAnimation(Animation)
		AnimationTrack:Play()
		wait(1)
		debounce = false
	end
end)

--SERVERSCRIPT
game.ReplicatedStorage.RemoteEvents.PickaxeEvent.OnServerEvent:Connect(function(player)
	local mouse = player:GetMouse()
	
	local Rock = game.Workspace.Rock
	if mouse.Target == Rock then
		local StoneValue = player.leaderstats.Stone
		StoneValue.Value += 1
	end
end)
--LOCALSCRIPT
local stonePickaxe = script.Parent
local debounce = false
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

stonePickaxe.Activated:Connect(function()
	if not debounce then
		print("Pickaxe was clicked")
		debounce = true
		game.ReplicatedStorage.RemoteEvents.PickaxeEvent:FireServer(mouse.Target)
		

		local Character = stonePickaxe.Parent
		local Humanoid = Character.Humanoid
		local Animation = stonePickaxe.Animation

		local AnimationTrack = Humanoid:WaitForChild("Animator"):LoadAnimation(Animation)
		AnimationTrack:Play()
		wait(1)
		debounce = false
	end
end)

--SERVERSCRIPT
game.ReplicatedStorage.RemoteEvents.PickaxeEvent.OnServerEvent:Connect(function(player, target)
	local Rock = game.Workspace.Rock
	if target == Rock then
		local StoneValue = player.leaderstats.Stone
		StoneValue.Value += 1
	end
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.