So I have a problem with my script. When I fire this remote event it only shows for the client. Heres the scripts.
Local Script:
local rp = game.ReplicatedStorage local remote = rp.Claim local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:Connect(function() print("Claimed") script.Parent.Parent.FinishOrderFrame.Visible = true script.Parent.Parent.FinishOrderFrame.Parent = player.PlayerGui.FinishOrder remote:FireServer(script.Parent.Parent.Claimed, player, script.Parent, script.Parent.Parent) end)
Server Script:
local rp = game.ReplicatedStorage local remote = rp.Claim remote.OnServerEvent:Connect(function(player, v, playername, z, x) v.Text = "Claimed by: "..playername.Name z.Visible = false wait(5) x:Destroy() end)
Can anybody help me why the remote event only shows for the person who clicks on the GUI button?
The objects you sent from the client (v,z,x) are only stored in the playerGui of the player. This is why it will not replicate to other clients. Instead you can use game:GetPlayers() and itterate through it with a for loop. For each itteration, you can update the guis elements inside the player gui to whatever you want.
Also, never trust the client. When you fired the remote event you gave some text label objects. This is not a good idea because exploiters can do the same thing, but change the textlabel.text property to something offensive and other players will see it.
Instead, you can rename the remote to something specific like "PlayerFoundSomething" and just fire the remote event with no arguments. Now if the exploiter fires to the server, it is impossible for the exploiter to change the text because the exploiter nor anyone can change the name of a player object (which is the only parameter by default).
Example:
-- Client local rp = game.ReplicatedStorage local remote = rp.Claim local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:Connect(function() print("Claimed") script.Parent.Parent.FinishOrderFrame.Visible = true script.Parent.Parent.FinishOrderFrame.Parent = player.PlayerGui.FinishOrder remote:FireServer() end) -- Server local rp = game.ReplicatedStorage local remote = rp.Claim remote.OnServerEvent:Connect(function(player) local players = game.Players:GetPlayers() -- All the clients in the game for _, player in pairs(players) do local playerGui = player.PlayerGui local textlabel = playerGui.Gui.textLabel texlabel.Text = "Claimed by: " .. player.Name wait(5) textlabel:Destroy() -- Customize this code inside of the for loop to your liking end end)
I hope this helps :)