Basically i’m doing a round system where the winner gets 500 Cash. The script will check which team that won. After that I have to trigger a remote event to the data store (profile service).
First I will send a remote event to the Client (you can’t send it from one server script to another as much I know)
MoneyEvent:FireAllClients()
Should I make a local script in client to see if they are in the right team, and then send a remoteevent to server if they are in winner team? The problem is they could spamm send that and change the amount of money. Does Anyone know how I can secure this Money giving system and make it better? Or how I could communicate between two server scripts?
3 Likes
local function SendEvent(team: string | Team, remote: RemoteEvent, ...)
local team = type(team) == "string" and game.Teams[team] or team
for _, player in pairs(team:GetPlayers()) do
remote:FireClient(player, ...)
end
end
SendEvent("Winners", MoneyEvent)
4 Likes
Could I do it like this?
local Teams = game:GetService("Teams")
local RedTeam = Teams["Red"]
local WinnerTeam = RedTeam
local function SendEvent(team: string, winnerTeam, remote)
if type(team) == "string" then
team = game.Teams:FindFirstChild(WinnerTeam)
end
for _, player in pairs(game.Players:GetPlayers()) do
if player.Team == team then remote:FireClient(player, ...) end
end
end
SendEvent("Winners",WinnerTeam, MoneyEvent)
1 Like