When creating RemoteEvents, you only need one of them. Create the RemoteEvent (in Studio) and store it in game.ReplicatedStorage.Modules.Events. On both the client and server, access the same RemoteEvent through a variable to make it easier. Be sure to name the RemoteEvent to something descriptive.
In your LocalScript, I also see that changeTextGui isn’t defined as a RemoteEvent. You should assign ReplicatedStorage.Modules.Event:FindFirstChild("ChangeTextGui") to it instead instead.
Ok, I changed my scripts and created a new remoteevent. I also assigned changeTextGui to what you told me to (I completely forgot). Nothing is happening, even still.
Be sure to always show your code and other relevant information, like the Explorer view of ReplicatedStorage, when providing updates. Makes things a lot smoother.
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local localPlayer = Players.LocalPlayer
local changeTextGui = ReplicatedStorage.Modules.Events:FindFirstChild("ChangeTextGui")
local playerGui = localPlayer:WaitForChild("PlayerGui")
local warnUnemployed = playerGui.gameResponse.WarnCharacter:Clone()
warnUnemployed.Title = "You are now unemployed because you left the area. Return to the cash register to keep your job."
warnUnemployed.Parent = playerGui.gameResponse
warnUnemployed.ContinueButton.MouseButton1Down:Connect(function()
warnUnemployed:Destroy()
end)
local function warningVisible()
warnUnemployed.Visible = true
end
changeTextGui.OnClientEvent:Connect(warningVisible)
serverscript:
local TeamService = game:GetService("Teams")
script.Parent.TriggerPolice.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
local character = humanoid.Parent
local localPlayer = Players:GetPlayerFromCharacter(character)
localPlayer.Team = TeamService.PoliceOfficer
end
end)
script.Parent.TriggerCafe.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
local character = humanoid.Parent
local localPlayer = Players:GetPlayerFromCharacter(character)
localPlayer.Team = TeamService.CafeWorker
end
end)
script.Parent.TriggerUnemploymentCafe.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
local character = humanoid.Parent
local localPlayer = Players:GetPlayerFromCharacter(character)
if localPlayer.Team == TeamService.CafeWorker then
local changeTextGui = game:GetService("ReplicatedStorage").Modules.Events:FindFirstChild("ChangeTextGui")
changeTextGui:FireClient(localPlayer, changeTextGui)
end
end
end)
Couldn’t you just connect the touched event on the client and not even have to worry about connecting a remote event?
In the local script:
local TeamService = game:GetService("Teams")
local TriggerUnemploymentCafe = -- put brick here
TriggerUnemploymentCafe.Touched:Connect(function(hit)
local playerHit = Players:GetPlayerFromCharacter(hit.Parent)
if playerHit == localPlayer and localPlayer.Team == TeamService.CafeWorker then
local warnUnemployed = playerGui.gameResponse.WarnCharacter:Clone()
warnUnemployed.Title = "You are now unemployed because you left the area. Return to the cash register to keep your job."
warnUnemployed.Parent = playerGui.gameResponse
warnUnemployed.ContinueButton.MouseButton1Down:Connect(function()
warnUnemployed:Destroy()
end)
warnUnemployed.Visible = true
end
end)
And on the server, you wouldn’t have a connection to TriggerUnemploymentCafe.
local PlayerService = game:GetService("Players")
local TeamService = game:GetService("Teams")
script.Parent.TriggerUnemploymentCafe.Touched:Connect(function(hit)
local Player = PlayerService:GetPlayerFromCharacter(hit.Parent)
if Player == PlayerService.LocalPlayer and PlayerService.LocalPlayer.Team == TeamService.CafeWorker then
local warnUnemployed = Player.PlayerGui.gameResponse.WarnCharacter:Clone()
warnUnemployed.Parent = Player.PlayerGui.gameResponse
warnUnemployed.Title = "You have left your job area. Return to the cash register to keep your job."
warnUnemployed.ContinueButton.MouseButton1Down:Connect(function()
warnUnemployed:Destroy()
end)
warnUnemployed.Visible = true
end
end)