My script is a remote event bound script with one local and another server. I can send information of where the mouse is but after that it just relays the same information over and over again which isn't very helpful. I was wondering if there was any fixes for this? Here's my scripts:
Local script
local Players = game:GetService("Players")
local localPlayer = Players.LocalPlayer -- from a LocalScript
local mouse = localPlayer:GetMouse()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UIS = game:GetService("UserInputService")
local MouseEvent = ReplicatedStorage:FindFirstChild("Mouse")
local Mouseposition = mouse.Hit
local mouseX = mouse.X
local mouseY = mouse.Y
UIS.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.Q then
if Players.LocalPlayer.Character then
MouseEvent:FireServer(mouseY)
end
end
end
end)
Server script:
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local createPartEvent = ReplicatedStorage:FindFirstChild("Spells")
local cooldown = "on"
local mouse = ReplicatedStorage:FindFirstChild("Mouse")
local function Recieved(player, mouse)
if cooldown ~= "off" then
local torso = player.Character:WaitForChild("HumanoidRootPart")
local Part = Instance.new("Part")
Part.Parent = torso
Part.Position = Vector3.new(0,mouse,0)
Part.CFrame = torso.CFrame + torso.CFrame.LookVector * 10
cooldown = "off"
wait(10)
cooldown = "on"
wait(10)
Part:Destroy()
end
end
mouse.OnServerEvent:Connect(Recieved)

3 comments
Was wondering why they don't work?
There is a variable and a parameter both named "mouse". So the script is getting confused at which one you mean in the function.
Erm it didnt do anything even if I changed it