I have come across an error in my code, but output apparently doesn't show any error, I'm curious to know what that error is. I've tried numerous things, such as printing outputs and checking the values being printed. Here's the code:
Players = game.Players:GetChildren()
Players1 = {}
Sniper = ""
function RandomSniper()
local Random = math.random(0,#Players1)
Sniper = Players1[Random]
print(Sniper)
return true
end
function PlayerToNumber()
if game.ReplicatedStorage.InfoValue == "Intermission: 0" then
for i,v in pairs(Players) do
table.insert(Players1, i, v.Name)
print(Players1[i])
end
end
end
function SniperToPosition()
print(RandomSniper())
if RandomSniper() == true then
local Sniper1 game.Players:FindFirstChild(Sniper)
Sniper1.Character.Torso.Position = game.Workspace.SpawningPart.Position + Vector3.new(0,5,0)
local Gun = game.ServerStorage.Sniper:Clone()
Gun.Parent = Sniper1.Backpack
end
end
PlayerToNumber()
RandomSniper()
SniperToPosition()

6 comments
I wasn't able to solve the problem, however I would like to say that I admire your ways of solving errors - I have never thought of using the print function this way since I thought it was completely useless. Ty to you, I manage to solve some of my own issues :D
What is the error exactly?
The function doesn't perform at all. Also, most of the print functions just return nil.
it is hard to find the error if you don't tell us what you want. You told us there was no error, but the result isn't what you wanted. tell us what you want, and what happens
The reason why I'm posting it here is that output doesn't show anything wrong with the script, but whenever I run it, nothing happens. It's supposed to chose a random player once a countdown ends, teleport them to a specific position and give them a gear, currently, it does nothing.
Really? At least tell us what your trying to do