1illum1na
(illumina)
January 15, 2024, 2:48am
#1
Why wont Mouse.Hit.Position work?
assets.Remotes.HookReplicate.OnServerEvent:Connect(function(player)
print("ODMGEARRRR")
local part = assets.Hook:Clone()
print("GOTHOOK")
local mouse = player:GetMouse()
print("GOTMOUSE")
local odmg = player.Character:FindFirstChild("Odmg")
print("GOTODMG")
part.Position = mouse.Hit.Position
print("PARTPOSITION")
part.Parent = game.Workspace
odmg.LeftGrapple2.Beam.Attachment1 = part:FindFirstChild("A1")
print("SUCCESS")
end)
Everything works until Mouse.Hit.Position
1 Like
MykoNil
(MykoNil)
January 15, 2024, 2:53am
#2
Hi. Do you receive an error message in the output? Does everything below mouse.hit.position work?
1 Like
1illum1na
(illumina)
January 15, 2024, 2:57am
#3
Hey. No there are no errors, and no nothing below mouse.hit.position works
1 Like
MykoNil
(MykoNil)
January 15, 2024, 3:02am
#4
I don’t use mouse.Hit or the mouse object at all so I’m not sure but. I don’t think the mouse can be captured from the server. You’d be better off getting the mouse object or mouse.Hit from the local script then send it to the server script that you’re trying to use it in.
i.e., assets.Remotes.HookReplicate.OnServerEvent:Connect(function(player, mouse)
2 Likes
1illum1na
(illumina)
January 15, 2024, 3:06am
#5
Hmm but then what would i do to clone the part to the mouse position?
ZoomSummit
(ZoomSummit)
January 15, 2024, 3:06am
#6
You are correct that the mouse can only be accessed by client scripts. If you ever want the server to have mouse.Hit.Position
, then it must be sent with the RemoteEvent. I don’t believe sending the mouse class will work either.
1 Like
MykoNil
(MykoNil)
January 15, 2024, 3:07am
#7
As @ZoomSummit said, you will have to pass the mouse.Hit to the server script via the remote event you already are firing.
It’s gonna look something like:
assets.Remotes.HookReplicate.OnServerEvent:Connect(function(player, mouseHitPosition)
-- Hiding the rest of the function to save space
-- Local script
remoteEvent:FireServer(mouse.Hit.Position)
2 Likes
1illum1na
(illumina)
January 15, 2024, 3:09am
#8
so something like this?
Assets.Remotes.HookReplicate:FireServer(mouse.Hit.Position)
2 Likes
system
(system)
Closed
January 29, 2024, 3:16am
#10
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.