I'm trying to clone the handle of a tool and place it at Mouse.Hit.p after I throw a knife and it touches an object, but for some reason it sends the clone to another position, I added a print to see where are the positions I click on and for example these positions:
-34, 15.6115894, 597.152893 -36, 16.7761078, 619.217163 -30, 28.9170475, 602.622864
Were all sent to:
0, -340282346638528859811704183484516925440, 0
And they are basically floating somewhere in oblivion, I tried to zoom to them but I can't see them, I am also not pressing on the skybox, I am clicking on existing parts in the world, here is the code as well:
pcall(function() local decorKnife = handle:Clone() for _,v in pairs (decorKnife:GetChildren()) do if not v:IsA("FileMesh") then v:Destroy() end end print(mousep) decorKnife.Anchored = true decorKnife.CFrame = CFrame.new(mousep, mousep) -- here it basically sends it to oblivion for some reason decorKnife.Name = "Decoration" decorKnife.Parent = workspace end)
I thought it may be a studio error so I tried it in-game, but the same thing happens in a server, I also tried to position it after I give it a parent, tried it without pcall, but nothing works...
@Vocules
Inside a local script inside the tool:
-- Skipped everything unnecessary rf = game:GetService("ReplicatedStorage"):WaitForChild("RemoteThrow") tool = script.Parent handle = tool:WaitForChild("Handle") rf:InvokeServer((mouse.Hit.p - handle.CFrame.p).unit, mouse.Hit.p)
Inside the server script inside the handle:
handle = script.Parent tool = handle.Parent rf = game:GetService("ReplicatedStorage"):WaitForChild("RemoteThrow") function rf.OnServerInvoke(player, direction, mousep) -- some unnecessary code pcall(function() local decorKnife = handle:Clone() for _,v in pairs (decorKnife:GetChildren()) do if not v:IsA("FileMesh") then v:Destroy() end end print(mousep) decorKnife.Anchored = true decorKnife.CFrame = CFrame.new(mousep, mousep) -- here it basically sends it to oblivion for some reason decorKnife.Name = "Decoration" decorKnife.Parent = workspace end) end