I am trying to create an Admin GUI where only admins can access and they have special privileges in the GUI. I have a kill button where the admin selects a player and clicks "KILL" and it would kill that player inside the game. But it does not seem to work. There are no errors inside the output and i'm working with RemoteEvents. In my localscript, I invoke a BindableFunction that checks if the player is an admin, and if true then run the kill script.
Local Script
local button = script.Parent
--User using the GUI
local player = game.Players.LocalPlayer
--Get Bindable Function
local bind = game:GetService("ReplicatedFirst"):WaitForChild("AdminCheck"):WaitForChild("Admin")
--Current player that is selected (string value)
local selected = script.Parent.Parent.Parent:WaitForChild("CurrentButton")
--KillEvent
local func = script.Parent.Parent.Parent.Events:WaitForChild("KillEvent")
button.MouseButton1Click:Connect(function()
--Run a check on the player to see if admin or not
local check = bind:Invoke(player)
--If admin, then run
if check then
print("Checked!")
--Fire the remote event
func:FireServer(player)
end
end)
Server Script
--KillEvent
local event = script.Parent.Parent.Parent.Events:WaitForChild("KillEvent")
--When invoked
event.OnServerEvent:Connect(function()
print("Invoked!")
--Get currently selected player (string value)
local currentPlayer = script.Parent.Parent.Parent:WaitForChild("CurrentButton")
--Find player
local player = game.Players:FindFirstChild(currentPlayer.Value)
--If found
if player then
--Kill player
player.Character:BreakJoints()
end
end)
This works in Studio but in the actual game, it would not print "Invoked!" but only print "Checked!"
Thanks to anyone who could help!

10 comments
Where is func located?
try removing player from line 18
func is located inside a folder that stores all the RemoteEvents
Don't do script.Parent for that, do game.ReplicatedStorage. whatever your folder is name.KillEvent
But my folder is inside the GUI..
Put it in ReplicatedStorage, much better place for remotes.
That may be it, because StarterGui isn't open always, everything from there gets cloned to PlayerGui, which is only accessable through the client
Is it working?
Okay, I moved the remotes into ReplicatedStorage, but the result is still the same?
Hmmm