-
What do I want to achieve?
I want to be able to find out if a user is holding the button down or if it has been released.
So using ContextActionService, if the user is on mobile/tablet it creates a button called Roll. Then when the user pressed that button it activated the Roll Function. However, when the user lets go it is supposed to unbind the function and stop it. -
What is the issue?
function Roll(name,input, object)
if input ~= Enum.UserInputState.Begin then return end
if plr.Character.Humanoid or plr.Character:WaitForChild("Humanoid") then
if db == false then
db = true
if input == Enum.UserInputState.Begin then
while input == Enum.UserInputState.Begin do
cumra.FieldOfView = 85
walk.SoundId = RollIdClone
walk.PlaybackSpeed = 1
rollAnimLoaded:Play()
dP:FireServer(plr)
wait(1)
rollAnimLoaded:Stop()
end
elseif input == Enum.UserInputState.End then
cumra.FieldOfView = 70
rollAnimLoaded:Stop()
walk.SoundId = WalkId
walk.PlaybackSpeed = 1.85
end
db = false
end
end
end
ContextAction:BindAction("roll", Roll,true)
ContextAction:SetTitle("roll","Roll")
ContextAction:SetPosition("roll",UDim2.new(0.72,-105,0.6,-25))
ContextAction:UnBindAction("roll")
It seems to get stuck on the UserInputState.Begin
-
What solutions have you tried so far?
I have tried looking at the developer hub, discord chat, and more. However, I can’t seem to debug this.