I can't change 'BoolValue'

I can’t change value i can’t find answer

Server script:

local function Combat(LocalPlayer, Animator, LocalHum, Punching)
	
	local Punches = Animator:LoadAnimation(PunchAnimations[count])
	
	if Punching and Punching.Value == false then						
		if count >= 1  and count <= 3 then
			Punching.Value = true
			Punches:Play()
			count = count + 1
			task.wait(.7)
			Punching.Value = false
		elseif count >= 4 then
			Punching.Value = true
			Punches:Play()
			count = 1
			task.wait(2)
			Punching.Value = false
		end
	end

	Punches.KeyframeReached:Connect(function(keyframe)
		if keyframe == 'Punched' then
			HitboxPunch(LocalPlayer)
		end
	end)
end


Remote.OnServerEvent:Connect(function(LocalPlayer,camera, Punching)
	
	local LocalChar = LocalPlayer.Character
	local LocalHum = LocalChar.Humanoid
	local LocalHumRP = LocalChar.HumanoidRootPart
	local LocalHumAnimator = LocalHum.Animator
	

	Combat(LocalPlayer, LocalHumAnimator, LocalHum, Punching)
	
	
end)

Local:

local UIS = game:GetService("UserInputService")
local RP = game:GetService("ReplicatedStorage")

local Modules = RP:WaitForChild("Modules")
local HitboxModule = Modules.HitboxModule

local Remotes = RP:WaitForChild("Remotes")
local Remote = Remotes.HitboxRemote


local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local camera = game.Workspace.CurrentCamera
local Punching = LocalPlayer.Character:WaitForChild('Punching')

UIS.InputBegan:Connect(function(input, chat)
	if chat then return end
	
	if input.UserInputType == Enum.UserInputType.MouseButton1 then
		Remote:FireServer(LocalPlayer, camera, Punching)
	end
end)

You don’t need to pass the player through the remote from the client, it is done automatically.

event:FireServer(1)
local function something(player, someValue)
    print(player.Name) --> the player that fired the event
    print(someValue) --> the value that was passed, in this case, 1
end

event.OnServerEvent:Connect(something)
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.