Alright, I have a little mini game thingy set up. In this game thingy, an arrow is supposed to spin (by TweenService) until the value “ChosenSpot” is not “nil”. When “ChosenSpot” is not “nil”, one last tween is performed to slowly stop on the CFrame.
My problem is this is failing sometimes, not every time does the Arrow stop and actually continues to spin while the rest if the script proceeds. IT DOES WORK, but its as if there is a 25% chance of the arrow being bugged like this.
My internet can be really wonky (I truly hate spectrum internet with all my heart), but I can’t be sure that internet is my issue here. If internet is my issue, any potential fix suggestions (in or out of roblox) would be greatly appreciated as I do get small internet error blips all the time.
I’m not sure if I can get a video of the same exact issue happening again without testing a bunch of times, but this is the client spin script:
local StopTween = false
local Pause = false
local Count = 0
local ChosenSpot = nil
local Time, EasingStyle = 0.1, Enum.EasingStyle.Linear
local Circle = game.Workspace:FindFirstChild("Circle")
local function Spin()
while task.wait() do
if not Pause then
Pause = true
if Count == 8 then
Count = 0
Count = Count + 1
elseif Count < 8 then
Count = Count + 1
end
if not StopTween then
local Info = TweenInfo.new(Time, EasingStyle)
local Tween = TweenService:Create(Circle:FindFirstChild("Arrow"), Info, {CFrame = CFrame.lookAt(Circle:FindFirstChild("Arrow").Position, Circle:FindFirstChild("Spot"..Count).Position)})
Tween:Play()
if ChosenSpot ~= nil then
print(ChosenSpot)
if Count + 1 == tonumber(string.sub(ChosenSpot, 5)) then
StopTween = true
Time = 0.45
EasingStyle = Enum.EasingStyle.Sine
local Info = TweenInfo.new(Time, EasingStyle)
local Tween = TweenService:Create(Circle:FindFirstChild("Arrow"), Info, {CFrame = CFrame.lookAt(Circle:FindFirstChild("Arrow").Position, Circle:FindFirstChild(ChosenSpot).Position)})
Tween:Play()
Tween.Completed:Wait()
ChosenSpot = nil
Player:SetAttribute("SpinnerEnabled", false)
coroutine.yield()
end
end
Tween.Completed:Connect(function()
Pause = false
end)
end
end
end
end
local SpinLoop = coroutine.create(Spin)
RemoteEvents:FindFirstChild("Spin").OnClientEvent:Connect(function(Action, PickedSpot)
if Action == "Start" then
coroutine.resume(SpinLoop)
Player:SetAttribute("SpinnerEnabled", true)
end
if Action == "FillIn" then
if ReplicatedStorage:GetAttribute("GameEnabled") then
if not Player:GetAttribute("SpinnerEnabled") then
if ReplicatedStorage:GetAttribute("SpinnerEnabled") then
Player:SetAttribute("SpinnerEnabled", true)
coroutine.resume(SpinLoop)
end
end
end
end
if Action == "SpotPicked" then
ChosenSpot = PickedSpot
print(PickedSpot)
print(ChosenSpot)
end
end)
For an idea, this is how the model is set up
Again, this HAS WORKED before, so I can’t be sure if it is a studio/script issue or an internet issue.
Thanks for any assistance.