6_388
(6_388)
February 26, 2023, 6:33pm
1
The Walkspeed of the LocalPlayer won’t change.
I also get this error: ReplicatedFirst.LoadingScript:6: attempt to index nil with 'Humanoid'
The walkspeed is supposed to change to 0, and then when the GUI finishes loading, it is supposed to go back to normal.
Code:
-- Loading Script --
local gui = script:WaitForChild("LoadingGui")
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character.Humanoid
gui.Parent = player.PlayerGui
gui.LoadingBlur.Parent = game.Lighting
script.Parent:RemoveDefaultLoadingScreen()
repeat
wait(.5)
until game:IsLoaded()
wait(5)
humanoid.WalkSpeed = 0
gui.Background:TweenPosition(UDim2.new(0,0,-1.5,0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quad,1)
wait(1)
repeat wait()
game.Lighting.LoadingBlur.Size = game.Lighting.LoadingBlur.Size - 1.5
until game.Lighting.LoadingBlur.Size <= 0
humanoid.Walkspeed = 16
gui:Destroy()
If anyone has any tips, it would be greatly appreciated!
replace line 6 with
local humanoid = character:WaitForChild("Humanoid")
hasoco
(kan ye)
February 26, 2023, 6:38pm
3
This part is causing the problem, so modify it like this:
local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
6_388
(6_388)
February 26, 2023, 6:38pm
4
That was my first try but then I get the error: ReplicatedFirst.LoadingScript:6: attempt to index nil with 'WaitForChild'
its :WaitForChild not .WaitForChild
Also in line 5, to get the character object consistently, do
local character = player.Character or player.CharacterAdded:Wait()
You can do the same for the player object as @hasoco has written, but often you won’t need to.
6_388
(6_388)
February 26, 2023, 6:42pm
6
When the Walkspeed is supposed to be changed back to 16, I get this error: Walkspeed is not a valid member of Humanoid "Workspace.FailedTypo.Humanoid"
1 Like
hasoco
(kan ye)
February 26, 2023, 6:43pm
7
Its WalkSpeed not Walkspeed… grammar error
1 Like
6_388
(6_388)
February 26, 2023, 6:44pm
8
Thank you for the help! Didn’t see the lowecase lol
system
(system)
Closed
March 12, 2023, 6:44pm
9
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.