Here’s the current situation: I’m using a rays to find the location of the mouse in the experience. Whenever that ray is on a part, and the LMB is clicked, the part will jump upwards. I’ve got it all to work. I’m making the part jump using body forces. The only problem is that this jump isn’t sudden. Is there a better alternative to make the part jump?
This is the code for the local script:
local UIS = game:GetService("UserInputService")
local RemoteLaunch = game:GetService("ReplicatedStorage").LaunchPart
local Camera = workspace.CurrentCamera
local P1 = game.Workspace:WaitForChild("P1")
local RaycastResult = nil
local Thread = coroutine.create(function()
while task.wait() do
local mousePos = UIS:GetMouseLocation()
local mouseRay = Camera:ViewportPointToRay(mousePos.X, mousePos.Y)
RaycastResult = workspace:Raycast(mouseRay.Origin, mouseRay.Direction * 400)
end
end)
coroutine.resume(Thread)
UIS.InputBegan:Connect(function(input, _)
if input.UserInputType == Enum.UserInputType.MouseButton1 and RaycastResult.Instance == game.Workspace.P1 then
RemoteLaunch:FireServer(P1)
print("Sent Signal")
end
end)
This is the code on the server side:
local RemoteLaunch = game:GetService("ReplicatedStorage").LaunchPart
RemoteLaunch.OnServerEvent:Connect(function(player, P1)
print("Received Signal")
P1.VectorForce.Force = Vector3.new(0,250,0)
task.wait()
P1.VectorForce.Force = Vector3.new(0,0,0)
end)