Hello!
I would like to get some help on fixing my throwable object code.
When you click to throw an object on the ground, it works fine. However, when in the sky, the object spawns far from the expected throw area.
Here it is:
script.Throw.OnServerEvent:Connect(function(plr, mousehit)
local grenadeobj = script.Parent.Handle.ThrowableOBJ:Clone()
grenadeobj.Transparency = 0
grenadeobj.Parent = workspace
grenadeobj.Position = plr.Character:WaitForChild("Head").Position
grenadeobj.Orientation = plr.Character:WaitForChild("Head").Orientation
grenadeobj.CanCollide = true
grenadeobj.Velocity = Vector3.new(mousehit.X,mousehit.Y,mousehit.Z)
end)
--A local script (script above is a server script.)
script.Parent.Activated:Connect(function()
script.Parent.Script.Throw:FireServer(game.Players.LocalPlayer:GetMouse().Hit)
end)
Thanks!