Why my game doesn't work?

Hey, I would like to know if my game is working cause a friend said that my game was actually not working …
The link of the game : Runner x clicker - Roblox
Ask me if you have a question !
EDIT : if the game is working you should run when click the screen and earn money !

When we play a game, we cannot see errors that being generated. You have to test run it and let us see what are errors inside your game.

1 Like

I do not have error in my game …

I give you the 2 scripts that can be the error :

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local UserId = Player.UserId
local Character = Player.Character
local Stages = workspace.Stages
local Folder = script.Parent
local ScreenGui = Folder.Parent
local Bar = Folder.Bar
local PercentageLabel = Folder.Percentage
local Profile = Folder.Profile
local ImageLabel = Profile.ImageLabel
local UserProfile = Players:GetUserThumbnailAsync(UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
local StageSize = ReplicatedStorage:WaitForChild("StageSize")
local Stage = ReplicatedStorage:WaitForChild("Stage")
local Wins = ReplicatedStorage:WaitForChild("Wins")
local Effect = ReplicatedStorage:WaitForChild("Effect2")
local MyFunctions = require(workspace.MyFunctions)
local RaceValues = {[1] = 1, [2] = 2, [3] = 10, [4] = 20, [5] = 100, [6] = 200, [7] = 1000, [8] = 2000, [9] = 10000, [10] = 20000}

ImageLabel.Image = UserProfile

Stage:GetPropertyChangedSignal("Value"):Connect(function()
	StageSize.Value = 2048 * 2 ^ (Stage.Value - 1)
end)

while wait() do
	local StartPosition = Stages:WaitForChild(Stage.Value).Position
	local Magnitude = (Character.PrimaryPart.Position - StartPosition).Magnitude
	local Distance = StageSize.Value - (StageSize.Value - Magnitude)
	Bar.Size = UDim2.fromScale(Distance / StageSize.Value, 1)
	Profile.Position = UDim2.fromScale(Distance / StageSize.Value - Profile.Size.X.Scale / 2, 1.5)
	PercentageLabel.Text = math.round(Distance * 100 / StageSize.Value).." %"
	if Bar.Size.X.Scale > 1 then
		Character:MoveTo(StartPosition)
		local RaceValue = RaceValues[Stage.Value]
		Wins.Value += RaceValue
		local NewEffect = Effect:Clone()
		NewEffect.Parent = ScreenGui
		NewEffect.Text = "+ "..MyFunctions.Format(RaceValue).." wins"
	end
end
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local Animator = Humanoid:WaitForChild("Animator")
local Mouse = Player:GetMouse()
local Folder = script.Parent
local StaminaBar = Folder.Bar
local EnergyPercentage = Folder.Percentage
local Running = false
local Timeout = 5
local RunnigTimeout = 0
local IdleTimeout = 0
local Stamina = ReplicatedStorage:WaitForChild("Stamina")
local Speed = ReplicatedStorage:WaitForChild("WalkSpeed")
local IsPlaying = ReplicatedStorage:WaitForChild("IsPlaying")
local InfiniteStaminaOwned = ReplicatedStorage:WaitForChild("InfiniteStaminaOwned")
local SpeedMultiplicator = ReplicatedStorage:WaitForChild("SpeedMultiplicator")
local Energy = Stamina.Value

local BreathlessAnimation = Instance.new("Animation")
BreathlessAnimation.AnimationId = "rbxassetid://12599662446"
local BreathlessAnimationTrack = Animator:LoadAnimation(BreathlessAnimation)

if InfiniteStaminaOwned.Value then
	EnergyPercentage.Text = "infinite %"
end

Mouse.Button1Down:Connect(function()
	if IsPlaying.Value then
		Humanoid:Move(Vector3.new(0, 0, -1))
		Timeout = 0
		if not Running and Energy > 0 then
			Running = true
			Humanoid.WalkSpeed = Speed.Value * SpeedMultiplicator.Value
		end
	end
end)

InfiniteStaminaOwned:GetPropertyChangedSignal("Value"):Connect(function()
	if InfiniteStaminaOwned.Value then
		EnergyPercentage.Text = "infinite %"
	end
end)

while wait(0.05) do
	if Timeout == 5 and Running then
		Running = false
		Humanoid.WalkSpeed = 0
		RunnigTimeout = 0
	elseif Running and RunnigTimeout == 20 and not InfiniteStaminaOwned.Value then
		RunnigTimeout = 0
		Energy -= math.round(Speed.Value/2)
		if Energy <= 0 then
			Energy = 0
			StaminaBar:TweenSize(UDim2.fromScale(0, 1), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 0.1)
			EnergyPercentage.Text = "0 %"
		else
			StaminaBar:TweenSize(UDim2.fromScale(Energy / Stamina.Value, 1), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 0.1)
			EnergyPercentage.Text = math.round(Energy * 100 / Stamina.Value).." %"
		end
	elseif Running and Energy == 0 and not InfiniteStaminaOwned.Value then
		Running = false
		Humanoid.WalkSpeed = 0
		RunnigTimeout = 0
		BreathlessAnimationTrack:Play()
		BreathlessAnimationTrack.Stopped:Wait()
	elseif Running then
		RunnigTimeout += 1
		Timeout += 1
	elseif Energy == 0 and IdleTimeout == 20 and not InfiniteStaminaOwned.Value then
		IdleTimeout = 0
		Energy += math.round(Stamina.Value / 5)
		if Energy > Stamina.Value then
			Energy = Stamina.Value
			StaminaBar:TweenSize(UDim2.fromScale(1, 1), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 0.1)
			EnergyPercentage.Text = "100 %"
		else
			StaminaBar:TweenSize(UDim2.fromScale(Energy / Stamina.Value, 1), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 0.1)
			EnergyPercentage.Text = math.round(Energy * 100 / Stamina.Value).." %"
		end
	elseif IdleTimeout == 20 and not InfiniteStaminaOwned.Value then
		IdleTimeout = 0
		if Energy < Stamina.Value then
			Energy += math.round(Stamina.Value / 5)
			if Energy > Stamina.Value then
				Energy = Stamina.Value
				StaminaBar:TweenSize(UDim2.fromScale(1, 1), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 0.1)
				EnergyPercentage.Text = "100 %"
			else
				StaminaBar:TweenSize(UDim2.fromScale(Energy / Stamina.Value, 1), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 0.1)
				EnergyPercentage.Text = math.round(Energy * 100 / Stamina.Value).." %"
			end
		end
	else
		IdleTimeout += 1
	end
end

When I played it, it worked perfectly fine. and it is fun too!

1 Like

Thanks you it’s very nice !!!
Have a nice day !

1 Like

It’s solved the player who were having bug was beta tester and they have last datastore so I have reset datastore and it work for them now !