How to make a welcome gui that won't make the player move

Hello! I have this welcome gui. What I want to do is prevent the player from moving until the “play” button is pressed. So how would I write it in this script?

local player = game.Players.LocalPlayer

script.Parent.TextButton.MouseButton1Click:Connect(function()
	script.Parent.TextButton:TweenPosition(UDim2.new(0.5, 0, 2, 0))
	script.Parent.TextLabel:TweenPosition(UDim2.new(0.5, 0, -2, 0))
	player.PlayerGui.Shop.TextButton:TweenPosition(UDim2.new(0.1, 0, 0.7, 0))
end)

Script type: Local
Location: In a screen gui.

There’s a few ways, but the easiest hack and most simple way is to set JumpPower/JumpHeight and WalkSpeed to 0 until the player fires the click action.

local player = game:GetService("Players").LocalPlayer --Define player
local character = player.Character or player.CharacterAdded:Wait() --Define Character
local humanoid = character:WaitForChild("Humanoid") --Define Humanoid

local OrigWalkS = humanoid.WalkSpeed --Save original walkspeed value
local OrigJumpP = humanoid.JumpPower --Save original jumppower value

humanoid.WalkSpeed = 0 --Set walkspeed to 0 so player cannot walk
humanoid.JumpPower = 0 --Set jumppower to 0 so player cannot jump

script.Parent.TextButton.MouseButton1Click:Connect(function() --Play button function
   humanoid.WalkSpeed = OrigWalkS --Set saved walkspeed back to player
   humanoid.JumpPower = OrigJumpP --Set saved jumppower back to player
end) --eof
2 Likes