script.Parent.Door.Touched:Connect(function(plr)
print('Touched')
local humanoid= plr.Parent:FindFirstChild("Humanoid")
if humanoid.WalkSpeed>=32 then -- Error
print("kicked")
if deb == false then
script.Parent.Door.ProximityPrompt.MaxActivationDistance=0
openSound:Play()
frame.CanCollide = false
tweenService:Create(frame,TweenInfo.new(.35),{CFrame = frameOpen.CFrame}):Play()
deb = true
print(deb)
task.wait(3)
frame.CanCollide = true
tweenService:Create(frame,TweenInfo.new(.35),{CFrame = frameClose.CFrame}):Play()
deb = false
print(deb)
script.Parent.Door.ProximityPrompt.MaxActivationDistance=32
end
end
end)
basically I want to create a door kick system, but the program doesn’t recognize the humanoid properly or something like that.
the output says: Attempt to index nil with WalkSpeed.
I know what it means, but I don’t know how to fix it.
There are no errors now, but it still doesn’t work. Only the print(“Touched”) part works now.
script.Parent.Door.Touched:Connect(function(plr)
print('Touched')
local humanoid= plr.Parent:FindFirstChild("Humanoid")
if humanoid then
if humanoid.WalkSpeed>=32 then-- doesn't register!
print("kicked")
if deb == false then
script.Parent.Door.ProximityPrompt.MaxActivationDistance=0
openSound:Play()
frame.CanCollide = false
tweenService:Create(frame,TweenInfo.new(.35),{CFrame = frameOpen.CFrame}):Play()
deb = true
print(deb)
task.wait(3)
frame.CanCollide = true
tweenService:Create(frame,TweenInfo.new(.35),{CFrame = frameClose.CFrame}):Play()
deb = false
print(deb)
script.Parent.Door.ProximityPrompt.MaxActivationDistance=32
end
end
end
end)
I have a sprint script that sets the player speed to 32.
UserInputService.InputBegan:Connect(function(input,gameProcessedEvent)
if input.KeyCode == keyboardButton or input.KeyCode == controllerButton and gameProcessedEvent == false then
pressed = true
humanoid.WalkSpeed = 32
end
end)
Im not quite sure but i think it is because you set the walkspeed in client which server won’t see that value.
You can add else in the door check (the one that check the speed) to double check (print the humanoid walkspeed)
The sprint script is located in starterCharacterscripts, and I added the code of what you said, print the humanoid walkspeed, and it returned at 16, not 32. So I suspected the same as you.