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

Why is my team change script malfunctioning? [SOLVED BY SELF]

Asked by 5 years ago
Edited 5 years ago

I made a FE team change script for my Sci-Fi space lab today, and.. It seems to not work.

Third Try [i had some previous attempts]

local Researcher = script.Parent.Researcher
local Security = script.Parent.Security
local player = game.Players.LocalPlayer

Researcher.MouseButton1Click:Connect(function()
    player.Team = game.Teams.Researcher
    game.ReplicatedStorage.Events.PlayerEvent:FireServer()
end)

Security.MouseButton1Click:Connect(function()
    player.Team = game.Teams.Security
        game.ReplicatedStorage.Events.PlayerEvent:FireServer()
end)

^ FE Team Script ^ v On Server Event v

local r = game:GetService("ReplicatedStorage")
local SEC = r.Events.TeamEvents.Security
local RES = r.Events.TeamEvents.Researcher

local playeradded = r.Events.ClientCon

game.Players.PlayerAdded:Connect(function(player)
    wait()
    playeradded:FireClient(player)
end)

SEC.OnServerEvent:Connect(function(splayer)
    splayer.TeamColor = BrickColor.new("Deep orange")
end)

RES.OnServerEvent:Connect(function(splayer)
    splayer.TeamColor = BrickColor.new("Cyan")
end)

Problem, it doesn't change my team without erroring.

0
you cant get the server storage from the client theking48989987 2147 — 5y
0
Oh.. How can i make it work correctly & functional? User#22722 20 — 5y
1
use ReplicatedStorage instead, since it can be accessed by the client and server so its the best place to put remote events and functions User#23365 30 — 5y
0
^ Ill try that. User#22722 20 — 5y
View all comments (5 more)
0
you need to show us your OnServerEvent code green271 635 — 5y
0
^ I didn't add that. User#22722 20 — 5y
0
If it's throwing an error then post it gullet 471 — 5y
0
It isnt erroring. User#22722 20 — 5y
0
Ok then check if it's running at all. Print something on line 1, if it's not it's either disabled or misplaced. gullet 471 — 5y

Answer this question