My print Statements aren't working

Dear Scripters,
I have been having an issue with my code that has been driving me insane and I just don’t know what to do. I’ve been trying to create a Footstep System which is better than previous ones I’ve made however this issue led me to scrapping all of my code

local Materials = {
		[Enum.Material.Grass] = "rbxassetid://7003103812",
		[Enum.Material.Sand] = "rbxassetid://9126733408",
		[Enum.Material.Snow] = "rbxassetid://9126732128",
		[Enum.Material.Pavement] = "rbxassetid://2599401908",
		[Enum.Material.Pavement] = "rbxassetid://2599401908",
		[Enum.Material.WoodPlanks] = "rbxassetid://9126931417"}

--Variables:
local Player = game.Players.LocalPlayer
local Character = Player.CharacterAdded:Wait()
local Humanoid  = Character:WaitForChild("Humanoid")
local RootPart = Character:WaitForChild("HumanoidRootPart")

local Animator = Humanoid:WaitForChild("Animator")

--Main:
print("Hello World!")

The problem here is the print statement. Although to me it seems perfectly fine it isn’t to be seen anywhere in the Output once I play the game. I’ve checked the dev console and it’s practically empty. Honestly it’s driving me insane and if I won’t be able to debug my code in the nearer future my life will be a living hell :smiley:

Edit: By the way the local script is located in StarterCharacterScripts so idk why the code isn’t working

1 Like

i solved script need to be local and located in StarterPlayerScripts

local Materials = {
	[Enum.Material.Grass] = "rbxassetid://7003103812",
	[Enum.Material.Sand] = "rbxassetid://9126733408",
	[Enum.Material.Snow] = "rbxassetid://9126732128",
	[Enum.Material.Pavement] = "rbxassetid://2599401908",
	[Enum.Material.Pavement] = "rbxassetid://2599401908",
	[Enum.Material.WoodPlanks] = "rbxassetid://9126931417",
}
print("Hello World!")

--Variables:
local Player = game.Players.LocalPlayer
local Humanoid  = script.Parent:WaitForChild("Humanoid")
local RootPart = script.Parent:WaitForChild("HumanoidRootPart")

local Animator = Humanoid:WaitForChild("Animator")

--Main:

Oh so print statements can’t come after variables? That’s weird is it a syntax thing?

ye kinda

God bless you man you’ve saved me from going insane. Genuinely appreciate it.!

1 Like

its my first solved problem welcome

1 Like

here’s more information:
the line local Character = Player.CharacterAdded:Wait() is preventing the code below it, that’s why it don’t print

Why though? The code is just checking that if the character is added then it waits and it fetches the Humanoid or anything inside of the character that is needed.

It pauses the script and continuously waits for the character property to change.

local Character = Player.Character or Player.CharacterAdded:Wait() -- this would check if there is a character, and if there wasn't, it would wait until there is a character

however, this will just wait until there’s a new character, even if there is already a character:

local Character = Player.CharacterAdded:Wait()
1 Like

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