Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

So i made it where you can change it where you can noclip but not noclip?

local textbox = script.Parent
local plr = game.Players.LocalPlayer

textbox.Focused:Connect(function()
	local i = 100
	i = i + 0
end)

textbox.FocusLost:Connect(function()
	if textbox.Text == "noclip" then
		game:GetService("RunService").Stepped:Connect(function()
			plr.Character.Humanoid:ChangeState(11)
		end)
	end
end)

ok so the title did not make sense but i made the script where you can no clip but idk how to make it where the noclip stops if you say clip in the textbox? Can someone help me?

1 answer

Use this code :D Hope it works!

local textbox = script.Parent
local plr = game.Players.LocalPlayer

textbox.Focused:Connect(function()
    local i = 100
    i = i + 0
end)

textbox.FocusLost:Connect(function()
    if textbox.Text == "noclip" then
        game:GetService("RunService").Stepped:Connect(function()
            plr.Character.Humanoid:ChangeState(11)
        end)
    elseif textbox.Text == "clip" then
        game:GetService("RunService").Stepped:Connect(function()
            plr.Character.Humanoid:ChangeState(18)
        end)
    end
end)

Here are the state types: https://developer.roblox.com/en-us/api-reference/enum/HumanoidStateType

Better Script

local textbox = script.Parent
local plr = game.Players.LocalPlayer

textbox.Focused:Connect(function()
    local i = 100
    i = i + 0
end)
game:GetService("RunService").Stepped:Connect(function()
	textbox.FocusLost:Connect(function()
		if textbox.Text == "noclip" then
			plr.Character.Humanoid:ChangeState(11)
		elseif textbox.Text == "clip" then
			plr.Character.Humanoid:ChangeState(18)
		end
	end)
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.