#How do you make a variable that counts your jumps?

1 messages · Page 1 of 1 (latest)

hearty stag
#

im trying to work on my first game which is a jumping simulator, how do i make a variable that counts jumps?

tacit yew
# hearty stag im trying to work on my first game which is a jumping simulator, how do i make a...

game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local humanoid = character:WaitForChild("Humanoid")
local jumpCount = 0

    humanoid.StateChanged:Connect(function(oldState, newState)
        if newState == Enum.HumanoidStateType.Jumping then
            jumpCount += 1
            print(player.Name.." has jumped "..jumpCount.." times")
        end
    end)
end)

end)

try this. if you want you can go add a text label on the screen or sum. open your output to see if its working. a print will appear

#

print(player.Name.." has jumped "..jumpCount.." times")

if you see this its working

hearty stag
#

ok

#

ty

tacit yew
#

just add a ui and link it to the script

tacit yew
hearty stag
#

im gonna learn ui later since im really new

tacit yew
#

go to uh playergui i think

#

lemme open roblox studio

#

ill tell you how to do it

#

go to this

#

insert object. screengui

#

right click on the screengui when u add it and type textbox

#

a white box will appear on your screen

#

insert object in ur textbox and select textlabel

#

once you do that, go to properties of the textlabel and configure it

#

wait

cosmic galeBOT
#

studio** You are now Level 2! **studio

tacit yew
#

dont add a text label

#

just do the textbox itself

#

rename it to like jumps: (jumps counted)

#

then to get rid of the white box if you want

#

just configure the background transparency to 1

#

and put the script i putted inside the screen gui

#

and it should work

#

@hearty stag

#

if it dosent work just search a tutorial ig

#

wait no putting the script i putted inside the screengui it wont work

#

cuz the screengui is not mentioned in the script

#

if you wanna do that just learn scripting and do it

hearty stag
tacit yew
#

ik u didnt ask

hearty stag
#

K

vagrant quarry
potent mirage
#

U were not even supposed to be given a whole system lil tecca

#

I would have flanked the doc’s link on your face if I was the gentle guy who patiently helped carried you

#

Next time i catch acting like that, nothing will happen