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

0

Where is func located?

0

try removing player from line 18

0

func is located inside a folder that stores all the RemoteEvents

0

Don't do script.Parent for that, do game.ReplicatedStorage. whatever your folder is name.KillEvent

0

But my folder is inside the GUI..

0

Put it in ReplicatedStorage, much better place for remotes.

0

That may be it, because StarterGui isn't open always, everything from there gets cloned to PlayerGui, which is only accessable through the client

0

Is it working?

0

Okay, I moved the remotes into ReplicatedStorage, but the result is still the same?

0

Hmmm