Hi there! I want an icon to show up and disappear (using ImageTransparency) when a player has a certain speed (in this case WalkSpeed must be 16).
local Player = game.Players.LocalPlayer local Character = Player.Character if Character.Humanoid.WalkSpeed == 16 then script.Parent.ImageTransparency = 0 end if Character.Humanoid.WalkSpeed == 11 then script.Parent.ImageTransparency = 1 end
This however.. gives me the following error:
Players.baukeblox12.PlayerGui.Stamina.Frame.SprintImage.LocalScript:5: attempt to index nil with 'Humanoid'
I am new to Roblox Development! So some explanation would be appreciated! :D
Either Character or Humanoid is loading too late. This happens super often; when the script loads before the player. Here are some modifications you can make.
local Character = Player.CharacterAdded:Wait() or Player.Character --This makes you wait for the Character to load, and then defines the Character local Humanoid = Character:WaitForChild("Humanoid") --This waits for the Humanoid to spawn before defining it.
Hopefully this helped.