Im using Fastcast to make a dodgeball throwing system and it works but I want the direction to be the players mouse. How would I do that using the remote events? ```
– server script
local toolball = workspace.Dodgeball
local plrStrength = 100000000000000
local rep = game:GetService(“ReplicatedStorage”)
local ball = rep.Ball
local fastcast = require(rep.Dependencies.FastCastRedux)
local caster = fastcast.new()
local behavior = fastcast.newBehavior()
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude
params.FilterDescendantsInstances = {toolball}
behavior.RaycastParams = params
behavior.Acceleration = Vector3.new(0, -50, 0)
behavior.MaxDistance = plrStrength
behavior.AutoIgnoreContainer = true
behavior.CosmeticBulletTemplate = ball
behavior.CosmeticBulletContainer = workspace.AvailableDodgeballs
local remoteEvent = game.ReplicatedStorage.Throw
caster.LengthChanged:Connect(function(ActiveCast, lastPoint, rayDir, displacement, segmentVelocity, cosmeticBulletObject)
local newPos = lastPoint + (rayDir * displacement)
cosmeticBulletObject.Position = newPos
end)
caster.RayHit:Connect(function(ActiveCast, RaycastResult, segmentVelocity, cosmeticBulletObject)
local explosion = Instance.new(“Explosion”)
explosion.BlastRadius = 40
explosion.Position = RaycastResult.Position
explosion.Parent = workspace
game:GetService("Debris"):AddItem(explosion, 0.2)
cosmeticBulletObject:Destroy()
end)
remoteEvent.OnServerEvent:Connect(function()
local pos = toolball.Handle.CFrame * CFrame.new(0,0,-50)
local direction = (pos.Position - toolball.Handle.Position).Unit
caster:Fire(toolball.Handle.Attachment.WorldPosition,direction, 200, behavior)
end)
–local script
local remoteEvent = game.ReplicatedStorage.Throw
local tool = script.Parent
local player = game.Players.LocalPlayer
local plrPos = player.Character.HumanoidRootPart.CFrame
tool.Activated:Connect(function()
remoteEvent:FireServer()
end)
Sorry the coding format is messed up idk why its doing that