( this is my first topic, im sorry if you see any mistakes )
-
What do you want to achieve? I want to move a part with mouse position on a grid, but i ran into a problem on start doing that.
-
What is the issue? I am using local script inside StarterPlayerScripts ( ill provide it below it lua code block ) which gets mouse position, prints it and fires it through bindable event, but when i try it, local script gives me an error
-
What solutions have you tried so far? I looked on developer hub for solutions, but didnt find anything, i tried to use common Script instead of LocalScript
I am not really experienced in scripting, so the problem would sound very stupid
LocalScript:
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local mouse = player:GetMouse()
local function onMouseMove()
print("mouse screen position: ", mouse.X, mouse.Y)
local PlE = game:GetService("ServerScriptService"):FindFirstChild("PlacementEvent")
local positionX = mouse.X
local positionY = mouse.Y
PlE:Fire(positionX, positionY)
end
mouse.Move:Connect(onMouseMove)
Script:
local PlE = game:GetService("ServerScriptService"):FindFirstChild("PlacementEvent")
PlE.Event:Connect(function(positionX, positionY)
print("X POS:", positionX)
print("Y POS:", positionY)
end)