Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to bind the space bar to an animation?

Asked by 4 years ago

I'm trying to make a jumping animation/sprite, I wanted to make it so whenever the player taps the spacebar the sprite plays.

How the script is supposed to work: When the spacebar is pressed the id's are supposed to cycle though while the player is jumping, making the sprite. Here is my failed attempt.

09 
10jumping = false
11UserInputService = game:GetService("UserInputService")
12local hum = script.Parent.Parent:FindFirstChild("Humanoid")
13local pose2 = script.Parent:FindFirstChild("PoseBooltest1")
14local df = script.Parent.Front2.Front2
15local go = false
View all 44 lines...

3 answers

Log in to vote
0
Answered by
Ludzik78 136
4 years ago

At line 08, U mispelt and made ?idblahblah= instead of ?id=blahblah

0
fixed, but same results SilverishReign 75 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
01local UserInputService=game:GetService("UserInputService")
02local df=script.Parent.Front2.Front2
03 
04local tab,i,debounce={6588763600,6596998485,6597000062,6597008331,6597011900,
056597011900,6597011900,6597011900,6597012454,6597013053,6597013593},1,false
06UserInputService.InputBegan:Connect(function(input)
07    if debounce then return end
08    if input.KeyCode == Enum.KeyCode.Space then
09        debounce=true
10        df.Image="rbxassetid://"..tab[i]
11        wait(3)
12        i=i<#tab and i+1 or 1
13        debounce=false
14    end
15end)
Log in to vote
0
Answered by 4 years ago

Click play, open workspace then click ur username in worspace, it should have a script called animate. Copy animate and its children then stop the game. Paste the animate script and its children into startercharacterscripts inside starter player. You can change the jump animation by editing that script and putting the ID there.

For your informaition:

The animate script's children are values so that the script can copy the id from the values then use the animation.

Answer this question