Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I need help with a admin bar gui the thing am doing is not working?

Asked by 5 years ago
Edited 5 years ago

Hi I want to make a admin bar I am using this script

local TEXTBOX = script.Parent.Parent.TextBox


script.Parent.MouseButton1Click:connect(function()

if TEXTBOX.Text == nuke then

    game.ReplicatedStorage.RemoteEvents["nuke"]:FireServer("Admin")

end

end)

the events work when I called them with command bar I have 1 textbox and 1 text button

0
You shouldn't use remotes that can cause server-damage. Just saying. Chaddaking 60 — 5y

1 answer

Log in to vote
0
Answered by
xPolarium 1388 Moderation Voter
5 years ago
Edited 5 years ago

Comparing wrong data types will make the conditional in a if-statement appear false.

You're trying to compare TEXTBOX.Text, which is a string value, to nuke, which is a non-defined variable or nil value.

Either define nuke as a variable with some string value or convert it to a string if that's how you want it.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvents = ReplicatedStorage:WaitForChild("RemoteEvents")

local nukeEvent = RemoteEvents:WaitForChild("nuke")

local textbox = script.Parent.Parent.TextBox

script.Parent.MouseButton1Click:Connect(function()
    if textbox.Text == "nuke" then
        nukeEvent:FireServer("Admin")
    end
end)

Please reply if this is what you were looking for as your explanation to the issue is a bit limiting.

0
yes thank you so much Module_Dev 0 — 5y
0
wait it does not work Module_Dev 0 — 5y
0
Re-edited to prevent any local loading bugs. Any errors in output? xPolarium 1388 — 5y
Ad

Answer this question