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()
There are no invisible errors
Only silly mistakes
local Sniper1 game.Players:FindFirstChild(Sniper)
isn't even Lua. Saying there's "no error" is absolute bollocks.
Really?? Use the wiki. The prints need to be like this.
print("Yay") print(Boo) print("Yay") error("help im using prints wrong and i cant look it up on the wiki help")
Basiclly, when using a word, not when locating a part, use a string like this
game.Workspace:FindFirstChild("Part")
Also, prints dont show a error if it prints "nil" Use a helpful resource called "your brain"