View difference between Paste ID: KEy9C3YQ and Nk7qn862
SHOW: | | - or go back to the newest paste.
1
local plr = game.Players.LocalPlayer --gets the player from the playerlist
2
local char = plr.Character --gets the character
3
local hum = char:WaitForChild("Humanoid") --gets the humanoid
4
local animation = hum:LoadAnimation(script:WaitForChild("Animation"))
5
local mouse = plr:GetMouse() --gets the mouse and all the functions you can do with it
6
local debounce = false --the cooldown variable
7
8
mouse.KeyDown:Connect(function(key) --if a key has been pressed
9
	if debounce == true then return end -- if the cooldown is active then stop the function
10
	if key == "z" then --if the key is z YOU CAN CHANGE THIS SO IT IS ANY KEY YOU WANT!
11
		debounce = true --cooldown active!
12
		animation:Play()
13
		wait(.3) -- waits a certain amount of time before making the mountain
14
		script.mountainfunc:FireServer() --fires a function called mountainfunc in the script
15
		wait(10) --the cooldown
16
		debounce = false --cooldown is not active
17
	end
18
end)