I have a script that is supposed to create an action then after one section, unbind the action that was created. The action is created, but it is not being unbound. Does anybody know what the problem is?
if not game:IsLoaded() then game.Loaded:Wait() end
local ContextActionService = game:GetService("ContextActionService")
ContextActionService:UnbindAction("jumpAction")
local UserInputService = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local invincibility = false
local dashCooldown = false
character:WaitForChild("Humanoid").JumpPower = 0
function mobileDashPress()
if dashCooldown == false then
invincibility = true
dashCooldown = true
character.Humanoid.WalkSpeed = 75
wait(0.4)
character.Humanoid.WalkSpeed = 16
wait(0.25)
dashCooldown = false
invincibility = false
end
end
ContextActionService:BindAction("DashButton", mobileDashPress, true, Enum.KeyCode.Space)
local DashButton = ContextActionService:GetButton("DashButton")
ContextActionService:SetPosition("DashButton", UDim2.new(1, -95,1, -90))
ContextActionService:SetImage("DashButton","http://www.roblox.com/asset/?id=5853926901")
DashButton.Size = UDim2.new(0, 70,0, 70)
task.wait(1)
ContextActionService:UnbindAction("DashButton")