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

A few questions about Lua...[?] Click for more information.

I have a few questions on a bit of animations and UserInputSystem and more. Here are some questions about different things below;

  1. If I made an animation that went off the coordinates, will the player it self move after the animation finishes?
  2. For UserInputSystem, how would I detect if a player is holding a keycode?
  3. For UserInputSystem, how would I detect if a player clicked a key code twice? (How to fire when a player pushes a key like twice or more)
  4. I looked at a tip and it said that 'wait()' is Deprecated, use 'Wait()' I tried doing it in a script but it just underlined red, how do I use 'Wait()' correctly?
  5. For a loading screen, is it possible to detect how much (in percent) the game assets has loaded? If so how?

If you plan answer 1 question of the above then please use the comment section (don't worry, I will upvote). Thank you for any feedback/help.

--BlackOrange3343

1 comment

1

For 4, it's the other way around. Use wait(). For 5, see http://wiki.roblox.com/index.php?title=Custom_loading_screen

1 answer

✓ Accepted answer

1.) No


2.) Example:

local UIS = game:GetService("UserInputService")

local keyDown = false
UIS.InputEnded:Connect(function(input)
	if(input.KeyCode==Enum.KeyCode.YOURKEY)then
		keyDown = false
	end
end)

UIS.InputBegan:Connect(function(input)
	if(input.KeyCode==Enum.KeyCode.YOURKEY)then
		keyDown = true
		while keyDown do
			print("KeyDown")
			wait()
		end
	end
end)

3.) Use a counting variable

local numPresses = 0

local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(input)
	if(input.KeyCode==Enum.KeyCode.YOURKEY)then
		numPresses = numPresses+1
		print("You pressed the key "..numPresses.." times!")
	end
end)

4.) The tip of the day says that :wait() is deprecated, not wait().

workspace.Part.Touched:Wait() -- use :Wait()

5.) Yes, use ContentActionProvider

3 comments

0

How would I get the percentages for 5? I wanted to make something so that if you click space 2 times fast then u do a double jump, if u click it 1 time slowly it would just jump. How would I do that?

0

BlackOrange3343, please note that this isn't a request site. If you need help with how stuffs work, check out the wiki.roblox.com

0

Adrian, I'm not requesting a script. If you are too dumb to know what requesting means then leave. I'm simply asking for a function that fires on 2 doubles space clicks. I'm not asking for no script

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