Hello, this is my first topic.
im trying to make When player touch a part, player team change to other team.
but this is what happen!
Can we see your script for the changing team? This is probably because you never get the specific player that touched the part.
-( StarterPlayerScript )-
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local TC = ReplicatedStorage:WaitForChild(“TeamChange”)
local WP = game.Workspace.WIbuPart
WP.Touched:Connect(function(hit)
if hit then
TC:FireServer()
end
end)
-( ServerScriptService )-
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local TC = ReplicatedStorage:WaitForChild(“TeamChange”)
TC.OnServerEvent:Connect(function(player)
player.TeamColor = BrickColor.new(“Medium stone grey”)
end)
Alright, so as I said, this is because you don’t get the certain player that touched it. You would use :GetPlayerFromCharacter()
and check if it is the local player.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TC = ReplicatedStorage:WaitForChild("TeamChange")
local WP = game.Workspace.WIbuPart
WP.Touched:Connect(function(hit)
local touchedplr = game.Players:GetPlayerFromCharacter(hit.Parent)
if touchedplr and touchedplr == game.Players.LocalPlayer then
TC:FireServer()
end
end)