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

Trying to make players team change server side?

Asked by 4 years ago

So basically what I am trying to do is to make my Local Team changer to change the players team color in server side so it appears to other players I have already made a remote event in my game I am just confused about how to script it so it fires the players team color so the players team can happen in the server. I am a Semi Medium level scripter so I need some learning to do. My Local Script works good but I want to make the players team appear on the server side. If you are confused just reply on why you are confused.

Here is the script btw

01script.Parent.Enabled = true
02local P = game.Players.LocalPlayer
03local H = P.Character
04local Dbutton = script.Parent.background.deploy
05local text = script.Parent.background.teamselected
06local teamchanged = game.ReplicatedStorage.Teamevents.TeamChanged ------Remote Event for help
07Dbutton.Visible = false
08function SEF()
09    P.TeamColor = game.Teams["Special Emergency Forces"].TeamColor
10    text.Text = "Special Emergency Forces"
11    Dbutton.Visible = true
12 
13end
14script.Parent.background.sef.MouseButton1Click:Connect(SEF)
15function RBN()
View all 58 lines...

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Use a RemoteEvent.

01-- \\ Server script.
02 
03local RemoteEvent = Instance.new("RemoteEvent")
04RemoteEvent.Name = "TeamChangeEvent"
05RemoteEvent.Parent = game:GetService("ReplicatedStorage")
06 
07RemoteEvent.OnServerEvent:Connect(function(player, team)
08    if not team or typeof(team) ~= "Instance" or not team:IsA("Team") then
09        return error("Attempted to supply team arugment with non-team object.")
10    end
11    player.TeamColor = team.TeamColor
12end)
13 
14-- \\ Client script.
15 
View all 22 lines...
0
It worked thank you I learned on how you need to use events if you want to fire something into the server it gave more context WindowsXPisathing 2 — 4y
0
@TheLuminet would I still use the MouseButoonClickEvent? WindowsXPisathing 2 — 4y
Ad

Answer this question