In my script, I try and change the walkspeed of the player. Here is the line:
player.Character.Humanoid.WalkSpeed = 0
This is in a proximity prompt and that is how I got the player. I dont know why but this will not do anything
In my script, I try and change the walkspeed of the player. Here is the line:
player.Character.Humanoid.WalkSpeed = 0
This is in a proximity prompt and that is how I got the player. I dont know why but this will not do anything
Try this:
local proximityprompt = script.Parent
proximityprompt.Triggered:Connect(function(player)
local Humanoid = player.Character:FindFirstChild("Humanoid")
Humanoid.WalkSpeed = 0
end)
hmm I tried it and it doesnt work
Can I see the script, please??
Try using :WaitForChild()
instead of :FindFirstChild()
. :FindFirstChild()
has been very unreliable in my experience.
local proximityprompt = script.Parent
proximityprompt.Triggered:Connect(function(player)
local Humanoid = player.Character:WaitForChild("Humanoid")
Humanoid.WalkSpeed = 0
end)
script.Parent.Triggered:Connect(function(player)
local Humanoid = player.Character:FindFirstChild(“Humanoid”)
Humanoid.WalkSpeed = 0
local cln = game.ReplicatedStorage.ChatGui
cln.Parent = player.PlayerGui
script.Parent.Enabled = false
player.CameraMode = “Classic”
player.CameraMaxZoomDistance = 0.6
print(player)
print(player.Character.Humanoid.WalkSpeed)
local plrgui = player.PlayerGui:WaitForChild("ChatGui")
local function NPCtalk(textsize, textscaled, words, firstresponse, secondresponse, name, showresponse)
for i, thing in pairs(cln:GetChildren()) do
thing.Visible = true
end
plrgui.InterFram.TextButton1.Text = firstresponse
plrgui.InterFram.TextButton2.Text = secondresponse
for i, ding in pairs(player.PlayerGui.ChatGui.InterFram:GetChildren()) do
if ding.ClassName == "TextButton" then
ding.Visible = false
end
end
plrgui.InterFram.TextLabel.TextScaled = textscaled
plrgui.InterFram.NameLabel.Text = name
print(player)
print(player.Character.Humanoid.WalkSpeed)
local text = words
for i = 1, #text do
player.PlayerGui.ChatGui.InterFram.TextLabel.Text = string.sub(text, 1, i)
script.Parent["UnderTale - Toriel(Text)"]:Play()
wait(0.2)
end
for i, ding in pairs(player.PlayerGui.ChatGui.InterFram:GetChildren()) do
if ding.ClassName == "TextButton" then
ding.Visible = showresponse
end
end
if secondresponse == "Goodbye" then
plrgui.InterFram.TextButton2.Text = "Goodbye"
plrgui.InterFram.TextButton2.MouseButton1Click:Connect(function()
cln:Destroy()
player.CameraMode = "LockFirstPerson"
script.Parent.Enabled = true
end)
end
end
wait(1.5)
NPCtalk(1,true,"Go. back. to. bed.", "Wow","Chicken","Mom",false)
print(player)
print(player.Character.Humanoid.WalkSpeed)
wait(2.5)
local cln2 = game.StarterGui.EndingGui:Clone()
cln2.Parent = player.PlayerGui
for i, item in pairs(player.Backpack:GetChildren()) do
item:Destroy()
end
for i, item in pairs(player.Character:GetChildren()) do
if item.ClassName == "Tool" then
item:Destroy()
end
end
print(player)
print(player.Character.Humanoid.WalkSpeed)
local Tweenserv = game:GetService("TweenService")
cln2.Frame.EndingName.Text = "Caught"
cln2.Frame.TextLabel.Text = "You know to win you are supposed to get pizza"
cln2.Frame:TweenPosition(UDim2.new(0,0,0,-40, Enum.EasingDirection.In, Enum.EasingStyle.Bounce, 2.5, false))
wait(3)
player.Caught.Value = true
cln2.Frame.Ending.Visible = true
cln2["Minecraft OOF Sound"]:Play()
wait(.7)
cln2.Frame.EndingName.Visible = true
cln2["Minecraft OOF Sound"]:Play()
wait(.5)
cln2.Frame.TextLabel.Visible = true
cln2["Minecraft OOF Sound"]:Play()
wait(2)
cln2.Frame.TextButton.Visible = true
end)
This is a server script right?
It is in a proximityprompt inside of a model inside of the workspace and yes, it is a script not a localscript. One more thing. when I print out what the walkspeed of the player is it says the walkspeed is 0 when it says the player walkspeed is 16. It is supposed to be 0
try printing the humanoids parent name to see if its even getting you