Having an issue with the confirmation of a folder existing in a character

Basically, I have a semi-functional combat system. I handle a lot of the combat related things on a singular script, and for the most part, everything seems to work. Until, I decide to begin to attempt blocking.

My blocking is handled through a set of folders, known as the Statuses. Now, the issue comes when the game doesn’t recognize that the statuses are made, even though they are directly seen.
image

It just outright breaks the script as seen here,

And combat is unable to be used. I am using FindFirstChild, yet it doesn’t seem to work?


Blocking.OnServerEvent:Connect(function(Character)
	
	if Debounce == false then
		if Character:FindFirstChild("Statuses").Running.Value == true then return end
		
		
		Character:FindFirstChild("Statuses").IsBlocking.Value = true
		
	end
end)

Release.OnServerEvent:Connect(function(Character)



	Character:FindFirstChild("Statuses"):FindFirstChild("IsBlocking").Value = false
	
	task.wait(3)
	Debounce = false
end)

And unfortunately the issues just don’t stop there, as no errors showing that combat will break with no proper error or reasoning and furthermore, but this isn’t for this post. I could also just send the game, and have people attempt to figure out but I sincerely have no idea at this point.

“FullStatusFolder” seems to be parented to “Character”, what is that exactly? It’s a variable, but yeah, what specifically?

The players character, by default, is inside the Workspace. The players’ Character is different than the player inside Players. In a local script, you can do this to get the players character:

local character = game.Players.LocalPlayer.Character

Another thing, using :WaitForChild("Statuses") may or may not fix the issue.


Edit: the wording of things might have been confusing.

This is an example of the player character:
image

This is an example of the player inside ‘Players’:
image

FullStatusFolder is a, Folder. Instance Folder that gets added once the character joins the game. This is through a ServerScript.

Character is the actual Character.

Player.CharacterAdded:Connect(function(Character)
		task.wait()

		Character.Parent = workspace.LivingThings

		local PHB = workspace.PlayerHitboxes


		local CHclone = CH:WaitForChild("CharsHitbox"):Clone()
		CHclone.Parent = PHB
		CHclone.Name = Player.Name.. "Hitbox"
		print("We stack the ms")
		local Effects = Instance.new("Folder")
		Effects.Parent = Character
		Effects.Name = "StatusFolder"

		local Attach1, Attach2, Attach3, Attach4, Attach5, Attach6 = Instance.new("Attachment"), Instance.new("Attachment"), Instance.new("Attachment"), Instance.new("Attachment"), Instance.new("Attachment"),Instance.new("Attachment")
		Attach1.Parent = Character.HumanoidRootPart
		Attach2.Parent = Character.Head
		Attach3.Parent = Character["Right Leg"]
		Attach4.Parent = Character["Left Leg"]
		Attach5.Parent = Character["Right Arm"]
		Attach6.Parent = Character["Left Arm"]

		local Weld = Instance.new("Motor6D")
		print("Created")
		
		local FullStatusFolder = Instance.new("Folder")
		FullStatusFolder.Parent = Character
		FullStatusFolder.Name = "Statuses"

I manually put it in a folder. Waiting would make sense to me, but the Statuses already exist. So, what is meant to happen is the issue at hand for me.

1 Like

If you have any RemoteEvents, the OnServerEvent’s first parameter is ‘Player’: RemoteEvent | Roblox Creator Documentation


You’d need to change the parameter before Character to player. Changing this:

Blocking.OnServerEvent:Connect(function(Character)

To this:

Blocking.OnServerEvent:Connect(function(player, Character)

Same for the release, make it this:

Release.OnServerEvent:Connect(function(player, Character)

Would changing that fix the issue?

Fixed it, I had thought I had to change the parameters, because I moved the scripts from starterpack to startercharacter. Thank you so much.

1 Like

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