Hi, so, I did a script of player skill, and I was trying to make support for Mobile users, but, it works first time, but whenever i die, the script just stop working somewhy.
There’s no errors in Output
Footage:
There’s the script:
local Player = game.Players.LocalPlayer
local Lighting = game.Lighting
local UIS = game:GetService("UserInputService")
local Tween = game:GetService("TweenService")
local Anim = require(game.ReplicatedStorage.GuiAnimations)
local Camera = workspace.CurrentCamera
local Bar = script.Parent.Parent.Parent.SkillBar.Bar
local Skill = game.ReplicatedStorage.Events.Skill
wait(3) -- wait necessario pq roblox é maravilhoso
local MobileSkill = Player.PlayerGui:FindFirstChild("Mobile").Skill
local Limit = Bar.Parent.Limit.Value
local IsUsing = false
local CanUse = true
local debounce = false
local MusicDistortion = workspace.CurrentMusic.Distort1
local MusicDistortion2 = workspace.CurrentMusic.Distort2
local Music = workspace.CurrentMusic
local CurrentExposure = Lighting.ExposureCompensation
local ExposureMath = Lighting.ExposureCompensation
ExposureMathNew = ExposureMath - 1.5
local CurrentFoV = Camera.FieldOfView
local CameraMath = Camera.FieldOfView
CameraMathNew = CameraMath + 15
local CurrentVolume = workspace.CurrentMusic.Volume
VolumeMath = CurrentVolume - .25
local Info = TweenInfo.new(.3, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0)
local InfoCam = TweenInfo.new(.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0)
local Exposure_Start = { ExposureCompensation = ExposureMathNew }
local Exposure_End = { ExposureCompensation = CurrentExposure }
local Camera_Start = { FieldOfView = CameraMathNew }
local Camera_End = { FieldOfView = CurrentFoV }
local Volume_Start = { Volume = VolumeMath }
local Volume_End = { Volume = CurrentVolume }
local Octave_Start = { Octave = 1 }
local HighGain_Start = { HighGain = 0 }
local LowGain_Start = { LowGain = 0 }
local MidGain_Start = { MidGain = 0 }
local Octave_End = { Octave = MusicDistortion.OctaveVal.Value }
local HighGain_End = { HighGain = MusicDistortion2.HighGainVal.Value }
local LowGain_End = { LowGain = MusicDistortion2.LowGainVal.Value }
local MidGain_End = { MidGain = MusicDistortion2.MidGainVal.Value }
function BeganMobile()
if Bar.Parent.Visible == true then
if CanUse == true then
IsUsing = true
local MobileSkill = Player.PlayerGui:FindFirstChild("Mobile").Skill
Bar.Parent:TweenSize(UDim2.new(0, 409,0, 8), Enum.EasingDirection.Out, Enum.EasingStyle.Back, 1, true)
--Anim.FadeOutHalf(DropShadow, .3, "Frame")
Tween:Create(Lighting, Info, Exposure_Start):Play()
Tween:Create(Camera, InfoCam, Camera_Start):Play()
Tween:Create(MusicDistortion, Info, Octave_End):Play()
Tween:Create(MusicDistortion2, Info, HighGain_End):Play()
Tween:Create(MusicDistortion2, Info, LowGain_End):Play()
Tween:Create(MusicDistortion2, Info, MidGain_End):Play()
Tween:Create(Music, Info, Volume_Start):Play()
script.Parent.Functionally.Sound.TimePosition = 0
script.Parent.Functionally.Sound:Play()
while Limit > 0 and IsUsing do
Limit = Limit - 5
Bar:TweenSize(UDim2.new(Limit/250, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0, true)
Skill:Fire("Enabled")
wait()
if Limit <= 0 then
CanUse = false
end
end
end
end
end
function EndedMobile()
if Bar.Parent.Visible == true then
IsUsing = false
local MobileSkill = Player.PlayerGui:FindFirstChild("Mobile").Skill
MobileSkill.IsUsing.Value = false
Bar.Parent:TweenSize(UDim2.new(0, 409,0, 2), Enum.EasingDirection.Out, Enum.EasingStyle.Back, 1, true)
--Anim.FadeIn(DropShadow, .3, "Frame")
Tween:Create(Lighting, Info, Exposure_End):Play()
Tween:Create(Camera, InfoCam, Camera_End):Play()
Tween:Create(MusicDistortion, Info, Octave_Start):Play()
Tween:Create(MusicDistortion2, Info, HighGain_Start):Play()
Tween:Create(MusicDistortion2, Info, LowGain_Start):Play()
Tween:Create(MusicDistortion2, Info, MidGain_Start):Play()
Tween:Create(Music, Info, Volume_End):Play()
script.Parent.Functionally.Sound.TimePosition = 41.35
if Limit <= 0 and IsUsing then
Limit = Limit +.75
Bar:TweenSize(UDim2.new(Limit/250, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0, true)
end
while Limit < 250 and not IsUsing do
Limit = Limit +.75
Bar:TweenSize(UDim2.new(Limit/250, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0, true)
Skill:Fire("Disabled")
wait()
if Limit >= 66 then
CanUse = true
debounce = false
end
end
end
end
MobileSkill.MouseButton1Click:Connect(function()
if MobileSkill.IsUsing.Value == true then
BeganMobile()
game["Run Service"].RenderStepped:Connect(function()
if Limit <= 0 then
MobileSkill.IsUsing.Value = false
EndedMobile()
end
end)
else
EndedMobile()
end
end)