So what I did was make a local script and a remote event and a server script.
Local Script:
local rp = game:GetService("ReplicatedStorage") local player = game:GetService("Players").LocalPlayer local Mouse = player:GetMouse() Mouse.Move:Connect(function() local MousePosition = Mouse.Hit.p rp.RemoteEvent:FireServer(Mouse.Hit.p) end)
Server Script:
local rp = game:GetService("ReplicatedStorage") local event = rp:WaitForChild("water") local mouse = rp:WaitForChild("mouse") rp.RemoteEvent.OnServerEvent:Connect(function(player,mp) print(player) print(mp) player.Character.Cylinder.Position = Vector3.new(mp) end)
the player.Character.Cylinder part is when a water cylinder attack's parent is set to the character, and then i try to put its position (vector3) to the mouse position (mp). All that happens is the water cylinder attack just appears in a weird position and doesn't move. No Errors. Please help!
Use CFrame instead of .position. I am not sure why that occurs with .position, but all I know is that you need to use CFrame.
This would be your serverscript!
local rp = game:GetService("ReplicatedStorage") local event = rp:WaitForChild("water") local mouse = rp:WaitForChild("mouse") rp.RemoteEvent.OnServerEvent:Connect(function(player,mp) print(player) print(mp) player.Character.Cylinder.CFrame = mp end)
And this your localscript:
local rp = game:GetService("ReplicatedStorage") local player = game:GetService("Players").LocalPlayer local Mouse = player:GetMouse() Mouse.Move:Connect(function() local MousePosition = Mouse.Hit rp.RemoteEvent:FireServer(MousePotition) end)