Why is my remote event passing along bad data?
I'm trying to have a local script fire a remote event to the server that allows a player to join a team of their choosing. The exact error message I receive is
16:45:25.304 - Workspace.Event Handler:10: attempt to index local 'playa' (a nil value)
Through printing what playerName and teamName are in the server script I've determined that both varibles are the string "stardon" Why? One should be a team and not a text string.
Here are my scripts
Local GUI script
03 | local PN = script.Parent.Parent.Parent.Parent.Parent.Parent.Name |
04 | local targetTN = game.Teams [ script.Parent.Text ] |
07 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
08 | local GiveMeJob = ReplicatedStorage:WaitForChild( "GiveMeJob" ) |
10 | GiveMeJob:FireServer(PN, targetTN) |
12 | script.Parent.MouseButton 1 Click:connect(click) |
Server Event Handling Script
01 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
02 | local GiveMeJob = ReplicatedStorage:WaitForChild( "GiveMeJob" ) |
03 | local spawns = game.Workspace.SpawnLocations:GetChildren() |
05 | local function hereIsJob(playerName, teamName) |
08 | local targetTeamColor = teamName.TeamColor |
09 | local playa = game.Players:FindFirstChild(playerName) |
13 | if spawns [ i ] .teamName = = targetTeamColor then |
14 | playa.Character:MoveTo(spawns [ i ] .Position + Vector 3. new( 0 , 10 , 0 )) |
18 | GiveMeJob.OnServerEvent:Connect(hereIsJob) |