#Hockey Puck Connect/Shoot

1 messages · Page 1 of 1 (latest)

hidden beacon
#

Hello! I recently created a new hockey game with my friend called NRHL, and I'm trying to create a shooting system, I have 2 scripts one inside of the tool "Player Stick" a local script, and one inside serverscript service a script. I will send them below.

The issue i have is that whenever the puck connects to my stick's blade named "blade" no capital, it doesnt shoot when i LMB it. Please help, thank you!

#

Here is the script inside server script server

#

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local ShootPuckEvent = Instance.new("RemoteEvent")
ShootPuckEvent.Name = "ShootPuckEvent"
ShootPuckEvent.Parent = ReplicatedStorage

local puck = workspace:WaitForChild("ball")

ShootPuckEvent.OnServerEvent:Connect(function(player, direction, speed)
--print("ShootPuckEvent from", player.Name, direction, speed)
if puck then
puck.Anchored = false
puck.CanCollide = true

    local bv = puck:FindFirstChild("BodyVelocity")
    if bv then bv:Destroy() end

    local bodyVelocity = Instance.new("BodyVelocity")
    bodyVelocity.Velocity = direction * speed
    bodyVelocity.MaxForce = Vector3.new(1e5, 1e5, 1e5)
    bodyVelocity.P = 1250
    bodyVelocity.Parent = puck

    delay(1, function()
        if bodyVelocity and bodyVelocity.Parent then
            bodyVelocity:Destroy()
        end
    end)
end

end)

stiff heart
#

probably dont need that if puck then

#

do you get this print? print("[LocalScript] Shooting puck toward:", shootDir) or this one print("ShootPuckEvent from", player.Name, direction, speed)?

late sluice
#

you should probably just use printing for now though to see what the issue actually is

hidden beacon
bright ironBOT
#

studio** You are now Level 5! **studio

hidden beacon
#

if u want i can send the new script via dms

late sluice
hidden beacon
#

good question

#

my friend made this script

late sluice
#

why aren't they making this post then

hidden beacon
#

script