FindFirstChild and WaitForChild is not working

I tried WaitForChild and Now I tried FindFirstChild and this is not working I even did a check to make sure the item is not Miss-spelled and it is still not working please help

Video
Roblox VR 2024.05.03 - 17.25.08.03.mp4

Script:

local Players = game.Players:GetPlayers()
local Sounds = script:WaitForChild("Playtime Sounds")
local HitBox = script.Parent
local Playtimegui = game.StarterGui:WaitForChild("Playtime ui")
local Rope = Playtimegui:WaitForChild("Rope")
local minigameprogress = script:WaitForChild("minigameprogress")
local minigameprogresstext = Playtimegui.Frame:WaitForChild("jumprope progress")
local contentloader = game:GetService("ContentProvider")
local isplaytimeavailable = script:WaitForChild("Isplaytimeavailable")

Sounds["Playtime's Theme"]:Play()

Ropeassets = {
"rbxassetid://17309020766",
"rbxassetid://17309020583",
"rbxassetid://17309020358",	
"rbxassetid://17309020210",
"rbxassetid://17309020023"
}


minigameprogress.Changed:Connect(function()
	minigameprogresstext.Value = minigameprogress
end)

contentloader:PreloadAsync(Ropeassets)

HitBox.Touched:Connect(function(part)
	local plr = game:GetService("Players"):GetPlayerFromCharacter(part.Parent)
	if plr then
		if plr:FindFirstChild("Student") and plr:FindFirstChild("isplaying") then
			if plr.isplaying.Value == false and isplaytimeavailable == true then
				plr.isplaying.Value = true
				isplaytimeavailable = false
				wait(0.2)
				plr.Character.Humanoid.WalkSpeed = 0
				plr.Character.Humanoid.JumpPower = 30
				Sounds["Playtime ready go!"]:Play()
				Playtimegui.Enabled = true
				Sounds["Playtime ready go!"]:Play()
				wait(Sounds["Playtime ready go!"].TimeLength)
				minigame(plr)
		else
			print(plr.Name.." Doe's not have the Student tag!")
		end
		end	
	end
end)

function minigame(plr)
	Rope.Image = "rbxassetid://17309020766"
	wait(0.2)
	Rope.Image = "rbxassetid://17309020583"
	wait(0.2)
	Rope.Image = "rbxassetid://17309020358"
	wait(0.2)
	Rope.Image = "rbxassetid://17309020210"
	wait(0.2)
	Rope.Image = "rbxassetid://17309020023"
	wait(0.2)
	Rope.Image = ""
	if plr.Character.Humanoid:GetState() == Enum.HumanoidStateType.Jumping then
		if minigameprogress == 0 then
			Sounds["Playtime 1"]:Play()
			minigameprogress = minigameprogress + 1
		end
	else
		Sounds["Playtime oops!"]:Play()
		minigameprogress = 0
	end
	if minigameprogress == 5 then
		plr.Playtimeui:Destroy()
		plr.Character.Humanoid.WalkSpeed = 16
		plr.Character.Humanoid.JumpPower = 0
		plr.isplaying.Value = false
	end
end

Does it also have isPlaying?

is it does like I really don’t know why this script is not working

is this script on the server? I’m pretty sure that if you made those player values on the client the server won’t recognize it’s there?

Also wouldn’t it be easier to add a bool value instance to see if player is student or not or just use teams instead?

1 Like

The value is stored on the client however I made a variable to get the player object from the server script

" local plr = game:GetService(“Players”):GetPlayerFromCharacter(part.Parent) "

When I did this the script was working fine form a while but then it started to just not work so I don’t really know

nvm I actually figured out the issue