Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Your title should be specific! Describe your problem concisely.?

Asked by 5 years ago
Edited 5 years ago

*** THIS QUESTION HAS BEEN ANSWERED***

i made a new team change gui. the team change is working. but players are not spawning on there team spawns. i made sure that the 4 spawns are not set to Neutral, and that the team colors. are the same. as the team.

also sorry about the title. for some odd reason, it was not letting use any other title

https://gyazo.com/35394477e5870871dd5b714ef549ed1f https://gyazo.com/f301ba09f5f84387ee7fd08e08587be1

--local script--

local Player = game.Players.LocalPlayer
local Teams = game:GetService("Teams")

script.Parent.MouseButton1Click:Connect(function()
    if Player then
        Player.Team = Teams:FindFirstChild("Hostiles")
        game.ReplicatedStorage.TeamChange:FireServer()
    end
end)

--script for remote--

game.ReplicatedStorage.TeamChange.OnServerEvent:Connect(function(Player)
    Player:LoadCharacter()
end)
0
Please use the code blocks for us to read it better.  Lugical 425 — 5y
0
ok done. thanks, BinarySolo 7 — 5y
0
:fireServer() is deprecated use :FireServer() User#23365 30 — 5y
0
thanks's, i changed that but it's still not fixing the spawning issue. the character, seems to just spawn on the first they spawn onto, even known they changed teams. BinarySolo 7 — 5y

1 answer

Log in to vote
0
Answered by
Lugical 425 Moderation Voter
5 years ago
Edited 5 years ago

From what I see, there's a little couple of errors.

When you fire RemoteEvents to the server, just make sure you capitalize it right, so instead of fireServer(), it should be FIreServer()

As well as that, to change the teams, you need to do that on the server, so it shows across everyone, so you'd need to send the server some info too. (If you change the player's team on the client, it only shows their team change to themselves, no everyone else)

Local Script

local Player = game.Players.LocalPlayer
local Teams = game:GetService("Teams")

script.Parent.MouseButton1Click:Connect(function()
    if Player then --Just to note, this isn't needed as it's on the client. You can still keep it in though.
        game.ReplicatedStorage.TeamChange:FireServer(Player) --Capitalize that "F"! Also, send the player to the server so they can change the team!
    end
end)

Server Script

game.ReplicatedStorage.TeamChange.OnServerEvent:Connect(function(Player)
    Player.Team = game.Teams.Hostiles
    Player:LoadCharacter()
end)

All in all, you just need to remember how the "grammar" involved with RemoteEvents is, and that teams need to be changed on the server. Hopefully this helps you out, and if there's some issues with it, lemme know!

EDIT: I am aware that he has used this answer for his question. He has told me he just didn't know how you accepted answers for the question.

0
thank's. knight, i fixed the :fireserver() to :Fireserver(Player) still seems to not work, if you want to see whats going on, heres the link. https://www.roblox.com/games/1619456768/BinarySolos-Place-Number-7 BinarySolo 7 — 5y
0
^ Make sure you changed the server script too, im fixing my typo Lugical 425 — 5y
0
Tell me if it still isnt working Lugical 425 — 5y
Ad

Answer this question