Basically I have this script where a person jumps and doesn't activate the tool, they'll have some consequences. My issue being is that I have teams, and the value shows up as my name instead of the actual team.

LocalScript:

local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local Court = Player:WaitForChild("Court")
local Debounce = false

local RepStorage = game:GetService("ReplicatedStorage")
local GameFolder = RepStorage:WaitForChild("GameFolder")
local TravelEvent = GameFolder:WaitForChild("Travel")

local Tool = script.Parent

Humanoid.Changed:Connect(function()
	if Humanoid.Jump == true and Character:FindFirstChild("VBL_Ball") and Debounce == false then
	Debounce = true
	wait(1)
		if Character:FindFirstChild("VBL_Ball") then
			if Court.Value == 1 then
				TravelEvent:FireServer(Player, Tool.team.Value) -- here
				print('FireServer')
				Debounce = false
			end
		end
	end
end)

ServerScript:

local RepStorage = game:GetService("ReplicatedStorage")
local GameFolder = RepStorage:WaitForChild("GameFolder")
local Travel = GameFolder:WaitForChild("Travel")

local model = script.Parent
local display = model.display

local tp1 = model.tp1
local tp2 = model.tp2

local gametime = model.time
local travel = model.travel

local start = model.start

local ball = game:GetService("ServerStorage"):WaitForChild("VBL_Ball")

Travel.OnServerEvent:Connect(function(Player, team)
	print('Server Event fired')
	print(team)
	print(Player)
	if start.Value == true and gametime.Value ~= 0 then
		gametime.Script.Disabled = true
		print('Time stopped')
		if team == "Really black" then
			--code
		elseif team == "Institutional white" then
			--code
		else
			wait()
		end
	end
end)

Here's the RemoteEvent that's inside the Team Value:

LocalScript:

local player = game.Players.LocalPlayer
local tool = script.Parent.Parent
local value = script.Parent

local Events = tool:WaitForChild("Events")
local ChangeTeam = Events:WaitForChild("ChangeTeam")

tool.Equipped:connect(function()
	ChangeTeam:FireServer()
end)

ServerScript:

local tool = script.Parent
local Events = tool:WaitForChild("Events")

local teamvalue = tool:WaitForChild("team")

local ChangeTeam = Events:WaitForChild("ChangeTeam")

local function onChangeTeam(player)
	local team = player.TeamColor
	teamvalue.Value = team
end

ChangeTeam.OnServerEvent:Connect(onChangeTeam)

Thanks,

LukeGabrieI

2 comments

2

You don't need to use the player with :FireServer() as the first arguement passed into .OnServerEvent is always the player, simply take out the part where you send the pleyer with :FireServer

0

genius