I recently tried to change the player’s walkspeed by accessing Humanoid through StarterCharacter using this code: Player.Character:FindFirstChild("Humanoid").WalkSpeed = ...
.
Here’s the full code if it’s part of the problem:
label = script.Parent.changelog
creds = script.Parent.creds
blur = game:GetService("Lighting").Blur
sgui = script.Parent.Parent
splayer = game:GetService("StarterPlayer")
script.Parent.Enabled = true
local Player = game:GetService("Players").LocalPlayer
repeat wait() until Player.Character
blur.Enabled = true
blur.Size = 25
sgui.Notification.Enabled = false
--splayer.CharacterWalkSpeed = 0
--splayer.CharacterJumpPower = 0
Player.Character:FindFirstChild("Humanoid").WalkSpeed = 0
Player.Character:FindFirstChild("Humanoid").JumpPower= 0
creds:TweenPosition(UDim2.new(0.5,0,0.196,0), "InOut", "Elastic", 1, true)
wait(3)
creds:TweenPosition(UDim2.new(1.4,0,0.196,0), "Out", "Elastic", 1, true)
wait(0.05)
label:TweenPosition(UDim2.new(0.05,0,0.196,0), "InOut", "Elastic", 1, true)
label.continue.MouseButton1Click:Connect(function()
label:TweenPosition(UDim2.new(-0.4,0,0.196,0), "Out", "Elastic", 1, true)
wait(0.1)
for i = 1, 0, -1 do
blur.Size = i
wait(.5)
end
--splayer.CharacterWalkSpeed = 16
--splayer.CharacterJumpPower = 50
Player.Character:FindFirstChild("Humanoid").WalkSpeed = 16
Player.Character:FindFirstChild("Humanoid").JumpPower = 50
sgui.Notification.Enabled = true
end)
But basically when I click the button, it doesn’t change the walkspeed or jumppower to their original numbers.
1 Like
Geolio9
(Tomate)
March 28, 2021, 5:52pm
#2
Try to use PlayerModule, like this:
local PlayerModule = require(game.Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule"))
local Controls = PlayerModule:GetControls()
Controls:Disable()--Disable Controls
Controls:Enable()--Enable Controls
It says theres an infinite yield on WaitForChild"PlayerModule"
Geolio9
(Tomate)
March 28, 2021, 6:01pm
#4
I can’t seem to get that error…
According to Studio, PlayerModule doesn’t exist in PlayerScripts:
Geolio9
(Tomate)
March 28, 2021, 6:06pm
#6
Hm, for me it shows up, I don’t know why it isn’t there…
Can you send a file copy of PlayerModule please?
Geolio9
(Tomate)
March 28, 2021, 6:09pm
#8
Now that I have PlayerModules, the UI appears on startup (which didn’t happen before), but still can’t move the character:
https://i.gyazo.com/973a0a4d9887cc1c9fe8ad7185768734.mp4
Geolio9
(Tomate)
March 28, 2021, 6:29pm
#10
Not sure why…
did you use Controls:Disable() in the beginning of the script?
Yeah, and then I enabled it at the end again:
label = script.Parent.changelog
creds = script.Parent.creds
blur = game:GetService("Lighting").Blur
sgui = script.Parent.Parent
splayer = game:GetService("StarterPlayer")
local PlayerModule = require(game.Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule"))
local Controls = PlayerModule:GetControls()
script.Parent.Enabled = true
local Player = game:GetService("Players").LocalPlayer
repeat wait() until Player.Character
blur.Enabled = true
blur.Size = 25
sgui.Notification.Enabled = false
Controls:Disable()--Disable Controls
creds:TweenPosition(UDim2.new(0.5,0,0.196,0), "InOut", "Elastic", 1, true)
wait(3)
creds:TweenPosition(UDim2.new(1.4,0,0.196,0), "Out", "Elastic", 1, true)
wait(0.05)
label:TweenPosition(UDim2.new(0.05,0,0.196,0), "InOut", "Elastic", 1, true)
label.continue.MouseButton1Click:Connect(function()
label:TweenPosition(UDim2.new(-0.4,0,0.196,0), "Out", "Elastic", 1, true)
wait(0.1)
for i = 1, 0, -1 do
blur.Size = i
wait(.5)
end
Controls:Enable()--Enable Controls
sgui.Notification.Enabled = true
end)
Geolio9
(Tomate)
March 28, 2021, 6:38pm
#12
I think the problem is the for loop, it seems unnecessary, and I don’t think it lets code after it run…
It runs sgui.Notification.Enabled = true
, and why is it unnecessary
Geolio9
(Tomate)
March 28, 2021, 6:41pm
#14
It is unnecessary because it only runs once
It is meant to run once, when the player clicks the button on a gui that only appears when they join. If you have an alternative, I’ll listen.
Geolio9
(Tomate)
March 28, 2021, 6:44pm
#16
You could just run it once, right?
Maybe not, but if not, why?
No the for loop is meant to make the blur have a gradual un-size, so it looks like the blur is fading away quickly.
Geolio9
(Tomate)
March 28, 2021, 6:48pm
#18
but it only runs once, it goes from 1, to, 0, by an increment of 1,
Right?
Xitral
(Guest)
March 28, 2021, 9:27pm
#19
Changing the Humanoid’s WalkSpeed only works using a Server Script .
If you’re using a Local Script then try creating a RemoteEvent that signals the server to change the WalkSpeed .
Hope this helps!