I want to change the position of the part based on the CFrame of the mouse, but I get this error: Bad argument #3 to 'Position' (expected Vector3, got object) I am using a RemoteEvent to transfer the CFrame value from the client to the server.
Here is the LocalScript:
local replicatedstorage = game:GetService("ReplicatedStorage")
local Player = game.Players.LocalPlayer -- Also, I noticed you weren't using 'local' to define your variables. Use that, as it sets the variable apart from a global variable.
local Mouse = Player:GetMouse()
local MouseCFrame = Mouse.Hit
local MousePosition = MouseCFrame.p
local event = replicatedstorage:WaitForChild("TestEvent")
function printpos()
MouseCFrame = Mouse.Hit
MousePosition = MouseCFrame.p
event:FireServer(MousePosition)
print (MousePosition)
end
Mouse.Button1Down:Connect(printpos)
Here is the Script for the server:
local replicatedstorage = game.ReplicatedStorage
local event = Instance.new("RemoteEvent")
event.Name = "TestEvent"
event.Parent = replicatedstorage
local part = game.Workspace.test
function movePart(coords)
part.Position = coords
print(coords)
end
event.OnServerEvent:Connect(movePart)

3 comments
so now the coords variable is actually the coordinates
so now the coords variable is actually the coordinates
Thank you very much, im going to try it!