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

Can someone help me with my problem?

I wanted to make a GUI so when the player sets their text box as a certain key it would work but I don't know a script for that I was wondering if someone could help me with it?

local enabled = true
Player = script.Parent.Parent
--Player:WaitForDataReady()
mouse = Player:GetMouse()
run = game:GetService("RunService")
function onKeyDown(key)
if not enabled then return end
enabled = false
	Key = key:lower()
	if key == "z" then
		RightShoulder = Player.Character.Torso["Right Shoulder"]
		LeftShoulder = Player.Character.Torso["Left Shoulder"]
		Run = game:GetService("RunService")
		for i = 1, 2 do
			for i = 1, 12 do
				LeftShoulder.C0 = LeftShoulder.C0 *CFrame.Angles(0, 0, -0.16)
				RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0.16)
				RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0.1, 0)
				LeftShoulder.C0 = LeftShoulder.C0 *CFrame.Angles(0, -0.1, 0)
				Run.Stepped:wait(0.01)
			end
			for i = 1, 12 do
				LeftShoulder.C0 = LeftShoulder.C0 *CFrame.Angles(0, 0.1, 0)
				RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, -0.1, 0)
				LeftShoulder.C0 = LeftShoulder.C0 *CFrame.Angles(0, 0, 0.16)
				RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, -0.16)
				Run.Stepped:wait(0.005)
			end
		end
			for i = 1, 12 do
				LeftShoulder.C0 = LeftShoulder.C0 *CFrame.Angles(0, 0, -0.16)
				RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, 0.16)
				RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0.1, 0)
				LeftShoulder.C0 = LeftShoulder.C0 *CFrame.Angles(0, -0.1, 0)
				Run.Stepped:wait(0.005)
			end
		game:GetService("Chat"):Chat(Player.Character.Head, "Destructive Art HADO33!")
		x = Instance.new("Part")
		x.BrickColor = BrickColor.new("Bright red")
		x.Size = Vector3.new(1, 1, 1)
		x.TopSurface = "Smooth"
		x.BottomSurface = "Smooth"
		x.Shape = "Ball"
		x.Name = Player.Name
		x.CanCollide = false
		x.Transparency = 0.7
		fd = script.Firedamage:clone()
		fd.Parent = x
		y = Instance.new("BodyVelocity")
		y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
		y.velocity = Player.Character.Torso.CFrame.lookVector*80
		x.Parent = Workspace
		y.Parent = x
		f = Instance.new("Fire", x)
		f.Size = 0
		f.Heat = 0
		x.CFrame = Player.Character.Torso.CFrame*CFrame.new(0, 0, -12)
		fd.Disabled = false
		game.Debris:AddItem(x, 6)
		wait(0.25)
		for i = 1, 12 do
			LeftShoulder.C0 = LeftShoulder.C0 *CFrame.Angles(0, 0.1, 0)
			RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, -0.1, 0)
			LeftShoulder.C0 = LeftShoulder.C0 *CFrame.Angles(0, 0, 0.16)
			RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, -0.16)
			Run.Stepped:wait(0.01)
		end
	end
wait(2)
enabled = true
end

mouse.KeyDown:connect(onKeyDown)

1 answer

So the text box's .Text can be read right? So you can do an if statement like this:

if #TextBox.Text==1 then
	if key == TextBox.Text then
		--Do your stuff
	else
	end
else
end

I hope this is what you needed, I think this is what you're trying to do, however if I'm wrong please give more information so I may provide a better answer!

2 comments

0

Should I remove the "Key == "z" " thing or anything else?

0

It is your choice, it could change the function of what it does, so just be careful about what you do, and try things out. Copy the script if you have to. :)

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