Why is this giving me an error

when i was typing my code for this localscript, i got the red underline when i type in the parameter that i put in the serverscript ( v.name ). gives me a syntax error because i had a period instead of a parenthesis even though my parenthesis looks fine

local victory = game.ReplicatedStorage.Victory

while true do
	victory.OnClientEvent:Connect(function(v.Name)
		
	end)
end

What are you actually trying to do here? There are two big problems/errors

  1. You have a new event connecting every heartbeat in an infinite loop. Your game will crash.
  2. You should be putting a parameter (variable) inside the parenthesis next to “function” and not an argument.

for number 2, isnt that what im doing right now?? btw i removed the while loop

v.Name isn’t a variable name, it is a property access. That’s why I am asking what you’re actually trying to do. Are you trying to fire the event? Then do

victory:FireClient(v.Name)

If you’re listening for it to fire, then do

victory.OnClientEvent:Connect(function(name)

end)

i dont need to add the v? cause the v is for my for loop from the server script that fired the event

You don’t need to reference an object that’s already part of a connection to a default roblox event because it carries over. What you need to look out for how ever is the player that fired the event, that’s the first parameter “name” which I’m assuming is a string value you’re trying to send from the script that fired to the event should be the second parameter.

name is the name of a player from the for loop: for i,v in pairs(game.Teams[“Playing”]:GetPlayers()) do

If this is a localscript receiving information from the server through a remote event then it should just be retentive to that specific player. Are you trying to send the other team mates to the player who gets the data from the remote event?

yeah its a localscript recieving the information from the serverscript. the information is supposed to be the player who won in a game im working on

Okay, so you want the game to broadcast the winner to every player?

no its just to that specific player

So it tells that player they’re the winner?

yeah thats basically what im trying to do

How is it getting the winner? Through another event? Or are you checking for a winner value with the for loop you mentioned?

checking the winner through that for loop because the winner would be the only one who hasnt died in the game

it checks for who is in a table

So the for loop runs every time the table is updated, right?

ill just send my entire scripts

server script:

ServerStorage = game:GetService("ServerStorage")
ReplicatedStorage = game:GetService("ReplicatedStorage")
Players = game:GetService("Players")
teams = game:GetService("Teams")
DataStoreService = game:GetService("DataStoreService")
CashDataStore = DataStoreService:GetDataStore("cashDataStore")

Maps = ServerStorage:WaitForChild('Maps'):GetChildren()
RoundStatus = ReplicatedStorage:WaitForChild('RoundStatus')

local Survivors = {}

while wait() do
	if #game.Players:GetPlayers() >= 2 then
		
		local countdown = 3
		for i = countdown, 0, -1 do
			RoundStatus.Value = "Intermission: "..i
			wait(1)
		end
		
		ChosenMap = Maps[math.random(1, #Maps)]:Clone()
		Spawns = ChosenMap:FindFirstChild('Spawns'):GetChildren()
			
		RoundStatus.Value = ChosenMap.Name.." has been chosen!"
		
		wait(5)
		
		countdown = 1
		for i = countdown, 0, -1 do
			ChosenMap.Parent = workspace
			RoundStatus.Value = "Teleporting everyone..."
			
			local Players = game.Players:GetPlayers()

			for _, Player in ipairs(game.Players:GetPlayers())do
				if Player.Character and Player.Character:WaitForChild('Humanoid') then
					RandomSpawn = Spawns[math.random(1, #Spawns)]
					Player.Character.HumanoidRootPart.CFrame = RandomSpawn.CFrame
					Player.TeamColor = BrickColor.new("Persimmon")
					Player.Character.Humanoid.MaxHealth = 100
					Player.Character.Humanoid.Health = 100
					Player.Character.Humanoid.WalkSpeed = 16
					Survivors[Player] = true
				end
			end
			
			wait(1)
		end
		
			countdown = 180
			for i = countdown, 0, -1 do
			RoundStatus.Value = "Game in progress: "..i
			
			local Survivor = game.Teams.Playing
			if #Survivor:GetPlayers() == 1 then
				for i,v in pairs(game.Teams["Playing"]:GetPlayers()) do
					v.leaderstats.Cash.Value += 1

					for _, Player in pairs(game.Players:GetChildren())do
						if Player.Character and Player.Character:FindFirstChild('Humanoid') then
							Player.Character.Humanoid:TakeDamage(9999999999)
						end
					end

					countdown = 5
					for i = countdown, 0, -1 do
						ChosenMap:Destroy()
						RoundStatus.Value = v.Name.. " has won!"
						local victory = game.ReplicatedStorage.Victory
						victory:FireClient(v)
						wait(1)
					end

				end
				break
			end
			
				wait(1)
			end
		
	else
		local dots = "..."

		repeat
			for i = 1,3 do
				RoundStatus.Value = "Waiting For Players"..string.sub(dots, 1, i)
				wait(1)
			end
		until #game.Players:GetPlayers() >= 2
	end

end

local script

local victory = game.ReplicatedStorage.Victory

victory.OnClientEvent:Connect(function(v)
	script.Parent.Visible = true
end)

Yeah if v is the player in that table then you’re sending the signal to that player so v is the player which you use to reference and then get the name of because the game sends the object over to the client aka the localscript.

so its good to just pass it off as v?