I have created an object with this code:
script.Parent.Touched:Connect(function(touched)
local humanoid = touched.Parent:WaitForChild("Humanoid")
if humanoid then
humanoid.Walkspeed = 32
end
end)
This code should increase the humanoid walk speed from 16 to 32 when the humanoid touches it. But the block doesn't increase the speed and Roblox Studios shows this error:
Walkspeed is not a valid member of Humanoid "Workspace.ZoopZappler1.Humanoid"
According to the wiki, you need WalkSpeed
with a capital "S". Your code uses Walkspeed
, with a lower-case "S".
Here's a fixed version:
local humanoid = touched.Parent:WaitForChild("Humanoid")
if humanoid then
humanoid.WalkSpeed = 32
end