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.
JumpingID = "http://www.roblox.com/asset/?id=6588763600" -- Ids
JumpingID1 = "http://www.roblox.com/asset/?id=6596998485"
JumpingID2 = "http://www.roblox.com/asset/?id=6597000062"
JumpingID3 = "http://www.roblox.com/asset/?id=6597008331"
JumpingID4 = "http://www.roblox.com/asset/?id=6597011900"
JumpingID5 = "http://www.roblox.com/asset/?id=6597012454"
JumpingID6 = "http://www.roblox.com/asset/?id=6597013053"
JumpingID7 = "http://www.roblox.com/asset/?id6597013593="
jumping = false
UserInputService = game:GetService("UserInputService")
local hum = script.Parent.Parent:FindFirstChild("Humanoid")
local pose2 = script.Parent:FindFirstChild("PoseBooltest1")
local df = script.Parent.Front2.Front2
local go = false
--------------------------
UserInputService.InputBegan:Connect(function(input,gameProccesedEvent)
if input.KeyCode == Enum.KeyCode.Space then --flips through images
if df.Image == JumpingID then
df.Image = JumpingID1
elseif df.Image == JumpingID1 then
df.Image = JumpingID2
jumping = true
elseif df.Image == JumpingID2 then
df.Image = JumpingID3
jumping = true
elseif df.Image == JumpingID3 and jumping then
df.Image = JumpingID4
elseif df.Image == JumpingID4 then
df.Image = JumpingID5
jumping = false
elseif df.Image == JumpingID5 and jumping == false then
df.Image = JumpingID6
elseif df.Image == JumpingID6 then
df.Image = JumpingID7
elseif df.Image == JumpingID7 then
df.Image = JumpingID
jumping = false
wait(3)
jumping = false
df.Image = JumpingID
end
end
end)

1 comment
fixed, but same results