Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Could I make a Gui Button that changes walkspeed?

Asked by 7 years ago
Edited 7 years ago

This is only part of my script. I wanna know how to do it with Instance.new I wanna know how I can make it where I can change my walkspeed to 100 when I click the Walkspeed button which is textbutton1.

walkspeedplr.Name = "WalkSpeedPlr"
walkspeedplr.Position = UDim2.new(0.1, 0, 0.2, 0)
walkspeedplr.Size = UDim2.new(0, 150, 0, 50)
walkspeedplr.Text = "WalkSpeed"
walkspeedplr.Font = Enum.Font.Highway
walkspeedplr.TextScaled = true
walkspeedplr.BackgroundTransparency = 0.5
walkspeedplr.BorderSizePixel = 0
walkspeedplr.Parent = Frame
-- This below is the broken part
walkspeedplr.MouseButton1Click:Connect(function()
    game.Workspace.DiscordID.Humanoid.WalkSpeed = 100
end)

1 answer

Log in to vote
0
Answered by 7 years ago

Make sure this is in a LocalScript so LocalPlayer can be used.


local textlabel = Instance.new("TextLabel") textlabel.Name = "TextLabel" textlabel.Position = UDim2.new(0, 0, 0, 0) textlabel.Size = UDim2.new(1, 0, 0.125, 0) textlabel.Text = "DiscordID's Gui" textlabel.Font = Enum.Font.SourceSansLight textlabel.TextScaled = true textlabel.BackgroundTransparency = 1 textlabel.TextStrokeTransparency = 1 textlabel.Parent = frame h = game:GetService("Players").LocalPlayer.Character --get the players character textbutton1.MouseButton1Click:Connect(function() h.WalkSpeed = 100 --set the players walkspeed to 100 end)

If there are any issues, please comment below.

1
Thank you so much I really appreciate it! :) TheForgottenTale 23 — 7y
1
I just realized that was the wrong piece of information. It says textlabel instead of textbutton :D But you still figured it out I appreicate it! TheForgottenTale 23 — 7y
0
No problem. PyccknnXakep 1225 — 7y
Ad

Answer this question