I need to make it so if the player times it incorrectly it dosent error out. Error occurs at line 110 “Positon is not a valid member of Frame” This only happens when I time it incorrectly, If it time it good then it works as normal, I thought the “else” put at line 115 would do it but apparently not
game.ReplicatedStorage.FightingEvents.KnockdownGui.OnClientEvent:Connect(function(player, Difficulty)
--TweenInformation
local TimerBar = Players.LocalPlayer.PlayerGui.FightingHud.Knockdown.Ticker
local SpotToHitFrame = Players.LocalPlayer.PlayerGui.FightingHud.Knockdown.SpotToHit
local TweenTime = nil
local StartHit = UDim2.new(0.426, 0, 0, 0)
local EndHit = UDim2.new(0.526, 0 , 0, 0)
Knockdown = true
if Difficulty == 1 then
TweenTime = 1
end
if Difficulty == 2 then
TweenTime = 2
end
if Difficulty == 3 then
TweenTime = 3
end
local KnockTimerGoals = {}
KnockTimerGoals.Position = UDim2.new(1, 0 , 0, 0)
wait(1)
local tweenInfo = TweenInfo.new(
0.5, -- Time
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
-1, -- RepeatCount (when less than zero the tween will loop indefinitely)
true, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime
)
local KnockTimerTween = TweenService:Create(TimerBar, tweenInfo, KnockTimerGoals)
KnockTimerTween:Play()
UserInputService.InputBegan:Connect(function(input, event)
if input.KeyCode == Enum.KeyCode.Space and Knockdown == true and event == false and KnockTimePressed == false then
KnockTimePressed = true
KnockTimerTween:Pause()
if TimerBar.Position.X.Scale >= StartHit.X.Scale or TimerBar.Positon.X.Scale <= EndHit.X.Scale then
print("TimedCorrectly")
TimerBar.Position = UDim2.new(0, 0, 0, 0)
wait(1)
KnockTimePressed = false
else
print("TimedBadly")
TimerBar.Position = UDim2.new(0, 0, 0, 0)
KnockTimerTween:Play()
wait(1)
KnockTimePressed = false
end
end
end)
end)