Script is simply unable to see this one specific child value, but can see all the others

I’m doing some scripting trying to make a sort of Jumping System. I’m making it have a CD by placing a Value into the character’s Effects folder, and deleting the Value once the cooldown is over.

The issue I’m running into is whenever I initiate the dash, even though in the explorer I can see the CD value being added into the correct folder, named the right thing, and initialized the right thing, when the script tries to find it, it cannot.

I’ve been slowly trying to figure it out and I’ve found out that for some reason the script simply is incapable of seeing specifically this value. First I put “effects:FindFirstChild(“NinjaJumpCD”)” This threw the error “NinjaJumpCD is not a valid member of AkusamiHaruki.Effects”. Then I made a for loop in order to see if the script can see NinjaJumpCD by iterating through the effects folder and printing the names, It can see everything but skips directly over NinjaJumpCD. I’ve done this same system before with a normal Dash, and it worked fine. a Local Script makes the value in the effects folder, and the Server Script deletes it once the Cooldown is over. But for some reason It’s just incapable of seeing the value this time.

Here’s the Local Script Related Code, There are comments to help understand, This isn’t the full thing just the part towards the end where the CD is Created.:

if charge >= 5 then
			Controls:Enable() -- Re-enables the players movment.
			local ninjaJumpCD = Instance.new("IntValue") -- Makes the Instance.
			ninjaJumpCD.Parent = effects -- effects is a folder in the character model meant to store values that both the server and client can access
			ninjaJumpCD.Name = "NinjaJumpCD" -- Sets the name to "NinjaJumpCD"
			ninjaJumpCD.Value = 1 -- Initializes the Value

                        -- The Things in this section doesn't matter
			print("Movement Handler | Charge is " .. tostring(charge) .. " Initiating Ninja Jump")
			ninjaJumpAnim:Play()
			ninjaJumpChargeAnim:Stop()
			local CameraDirection = camera.CFrame.LookVector
                        
			ninjaJumpRemote:FireServer(charge,CameraDirection) -- Fires a signal to the server of the level of charge and the camera's direction.

			hum:ChangeState(Enum.HumanoidStateType.Jumping)
			hum.JumpHeight = charge*3
			wait(.1)
			hum.JumpHeight = 0
		else
			ninjaJumpChargeAnim:Stop()
		end

Here’s the ServerScript Related Code, There are comments to help understand, This isn’t the full thing just the part towards the end where the CD is meant to be deleted, This is after all of the work to figure out where the error was:

if not debounce then -- debounce check
                        -- This block is just for movement
			debounce = true
			local dashForce = Instance.new("LinearVelocity")
			dashForce.Parent = root
			dashForce.MaxForce = 99999999999999
			dashForce.VelocityConstraintMode = "Vector"
			dashForce.Attachment0 = root.RootRigAttachment
			dashForce.RelativeTo = "Attachment0"
			dashForce.VectorVelocity = Vector3.new(0,0,-jumpSpeed)
			
	
			
			
			wait(duration) -- duration is a value to know how long the force should be there
			dashForce:Destroy() -- destroys the force

			wait(cooldown) -- Waits for the duration of the cooldown
			debounce = false -- sets debounce to false

			for i,v in pairs(effects:GetChildren()) do -- This Iterates through the effects folder to get what the children are, Debug purposes.
				print("MovementServerHandler | Children of effect: " .. v.Name)
			end
			
			if effects:FindFirstChild("NinjaJumpCD") then -- If it finds NinjaJumpCD it destroys it.
				print("NinjaJump CD Found, Destroying NinjaJumpCD")
				effects:FindFirstChild("NinjaJumpCD"):Destroy()
			else
				-- If there was No NinjaJumpCD found, it waits for it and then destroys it. Added for Debug Purposes.
				print("No NinjaJump CD Found, waiting")
				local CD = effects:WaitForChild("NinjaJumpCD")
				if CD then CD:Destroy() end
			end

		end

Here is a screenshot of the Output for the Prints and things.

During a Studio Playtest, I Verified exactly what was in the explorer to see if NinjaJumpCD Simply wasn’t added correctly, Below is a Screenshot of the PlayTest Explorer:
image

And Just for clarity, here is a gif/Video of The entire Playtest.

I Really Don’t know what to do at this point. I cant think of anything else.

(I will be editing this post based on new events found and new information gathered.)

Any sort of help would be appreciated.

If I understand correctly this is local script

And this is ServerScript

If yes then the problem is a replication issue because you create NinjaJumpCD on client (the object that create on client won’t replicate to server so server won’t see it) so I suggest that you move these line to ServerScript

This is false because I have another section in this script that does precisely the same exact thing, Just is named differently. Which is why I’m not sure what is going on here.

1 Like

Alright so, Clown of the year here. As it turns out, you were right. I didn’t realize when I made the other section I also had the other value be deleted Client Side, not server-side (Though I did have a server-side code block to destroy it, said code block never actually ran because it couldn’t see the value.) Sorry for ever doubting you.

1 Like