Dash only works in studio but not in game?

Hey guys. So I’m currently working on a battlegrounds-like game. One mechanic I’m working on is a dash attack. For some reason, it works perfectly fine in studio testing but doesn’t work at all in the published game. Here’s the script for my input manager (including m1 attacks):

local uis = game:GetService("UserInputService")
local dashBE = script.Dash

local rs = game:GetService("ReplicatedStorage")
local hitboxEvt = rs.REs.BasicHitbox

local plrs = game:GetService("Players")
local plr = plrs.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()

--For M1 Attacks
local atkcooldown = char:GetAttribute("BasicAtkCooldown")
local atkdb = false
local combInd = 0
local lastHit
local elapsed

--For Dashes
local dashdb = false
local DashCooldown = char:GetAttribute("DashCooldown")

local selectedCharacter = plr:WaitForChild("currentCharacter")
local anims = rs.Animations[selectedCharacter.Value].BasicCombo

char.Humanoid.Died:Connect(function()
	char = nil
	task.wait(plrs.RespawnTime)
	char = plr.CharacterAdded:Wait()
end)

uis.InputBegan:Connect(function(input, chatted)
	if chatted then return end
	
	if char and char.Humanoid.Health > 0 then
		if char:GetAttribute("Stunned") == false then
			if input.KeyCode == Enum.KeyCode.Q then
				if dashdb == false then
					dashdb = true
					local dashDirection = "Forward"
					if uis:IsKeyDown(Enum.KeyCode.A) then
						dashDirection = "Left"
					elseif uis:IsKeyDown(Enum.KeyCode.D) then
						dashDirection = "Right"
					elseif uis:IsKeyDown(Enum.KeyCode.S) then
						dashDirection = "Back"
					end
					dashBE:Invoke(dashDirection)
					task.wait(DashCooldown)
					dashdb = false
				end
			end
			
			if input.UserInputType == Enum.UserInputType.MouseButton1 then
				if atkdb == false then
					atkdb = true 
					if lastHit then
						elapsed = os.clock() - lastHit
						if elapsed < 1 then
							combInd += 1
							if combInd > 4 then
								combInd = 1
							end
						else
							combInd = 1
						end
					else
						combInd = 1
					end
					for i, v in pairs(anims:GetChildren()) do
						if v.Name == "punch"..combInd then
							local anim: AnimationTrack = char.Humanoid.Animator:LoadAnimation(v)
							anim:Play()
							anim:GetMarkerReachedSignal("Hit"):Connect(function()
								if combInd == 4 then
									hitboxEvt:FireServer(true, 15)
								else
									hitboxEvt:FireServer(false, 10)
								end
							end)
						end
					end
				end
				if combInd == 4 then
					task.wait(1)
				end
				lastHit = os.clock()
				task.wait(atkcooldown)
				atkdb = false
			end
		end
	end
end)

and here’s the dash script which uses a bindable function to work:

local dashBE = script.Parent

local plrs = game:GetService("Players")
local plr = plrs.LocalPlayer
local char = plr.CharacterAdded:Wait()
local hrp: Part = char:WaitForChild("HumanoidRootPart")
local hum: Humanoid = char:WaitForChild("Humanoid")
local animator: Animator = hum:WaitForChild("Animator")

hum.Died:Connect(function()
	char = nil
	task.wait(plrs.RespawnTime)
	char = plr.CharacterAdded:Wait()
	animator = hum:WaitForChild("Animator")
	hum = char:WaitForChild("Humanoid")
	hrp = char:WaitForChild("HumanoidRootPart")
end)


local dasDur = 0.35
local rate = 0.05

dashBE.OnInvoke = function(dashDirection) 
	local bv = Instance.new("BodyVelocity")
	bv.MaxForce = Vector3.new(100000, 0, 100000)
	bv.Parent = hrp
	
	local dashStrength = 100
	local minDashStrength = dashStrength * 0.15
	local amntOfIterations = dasDur / rate
	local removalOfStrengthPerIteration = dashStrength / amntOfIterations
		
	for i = 0, dasDur, rate do
		if dashDirection == "Forward" then
			bv.Velocity = hrp.CFrame.LookVector * dashStrength
		elseif dashDirection == "Back" then
			bv.Velocity = (hrp.CFrame.LookVector * -1) * dashStrength
		elseif dashDirection == "Left" then
			bv.Velocity = (hrp.CFrame.RightVector * -1) * dashStrength
		elseif dashDirection == "Right" then
			bv.Velocity = hrp.CFrame.RightVector * dashStrength
		end
		if dashStrength > minDashStrength then
			dashStrength -= removalOfStrengthPerIteration
			if dashStrength < minDashStrength then
				dashStrength = minDashStrength
			end
		end
		task.wait(rate)
	end
	bv:Destroy()
end

I’ve tried to rework it a few times but nothing seems to be helping. Any insight is appreciated.

use a RemoteFunction or RemoteEvent instead of BindableFunction.

and force the character to reload

plr.CharacterAdded:Connect(function(newCharacter)
    char = newCharacter
    hum = char:WaitForChild("Humanoid")
    hrp = char:WaitForChild("HumanoidRootPart")
end)

PS: Allow HTTP and API

Thanks for the insight. What i’ve done so far was changed the bindable function to a bindable event only because i’ve tried using a remote function for it and it didn’t work at all. Im still facing the same issue where it works in studio but not in the actual game. Anything else you could think of? Let me know if you need anything more from me.