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.

01walkspeedplr.Name = "WalkSpeedPlr"
02walkspeedplr.Position = UDim2.new(0.1, 0, 0.2, 0)
03walkspeedplr.Size = UDim2.new(0, 150, 0, 50)
04walkspeedplr.Text = "WalkSpeed"
05walkspeedplr.Font = Enum.Font.Highway
06walkspeedplr.TextScaled = true
07walkspeedplr.BackgroundTransparency = 0.5
08walkspeedplr.BorderSizePixel = 0
09walkspeedplr.Parent = Frame
10-- This below is the broken part
11walkspeedplr.MouseButton1Click:Connect(function()
12    game.Workspace.DiscordID.Humanoid.WalkSpeed = 100
13end)

1 answer

Log in to vote
0
Answered by 7 years ago

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

01local textlabel = Instance.new("TextLabel")
02textlabel.Name = "TextLabel"
03textlabel.Position = UDim2.new(0, 0, 0, 0)
04textlabel.Size = UDim2.new(1, 0, 0.125, 0)
05textlabel.Text = "DiscordID's Gui"
06textlabel.Font = Enum.Font.SourceSansLight
07textlabel.TextScaled = true
08textlabel.BackgroundTransparency = 1
09textlabel.TextStrokeTransparency = 1
10textlabel.Parent = frame
11 
12h = game:GetService("Players").LocalPlayer.Character --get the players character
13textbutton1.MouseButton1Click:Connect(function()
14    h.WalkSpeed = 100 --set the players walkspeed to 100
15end)

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