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

How do I make a function on typed in a text box?

Asked by 4 years ago

I'm making a Roblox Camping game, but the problem is I don't want my friends to have to ALWAYS pay robux to respawn. So I decided to make a secret code you may type to respawn. the problem is, I DON'T KNOW HOW!!!

1 answer

Log in to vote
1
Answered by 4 years ago

Here is a way you can do it.

Make a RemoteEvent in ReplicatedStorage called "Respawn"

Make a TextBox in the Respawn gui

Make a TextButton in the Respawn gui too

Make a script inside of ServerScriptService

Make a script inside the TextButton

In the script inside of the TextButton inside of the Respawn gui put this into it:

script.Parent.MouseButton1Click:Connect(function()
local Code = script.Parent.Parent.TextBox.Text
game.ReplicatedStorage.Respawn:FireServer(Code)
end)

Now in the script inside of ServerScriptService type this:

game:GetService("ReplicatedStorage"):WaitForChild("Respawn").OnServerEvent:Connect(function(Player, Code)
if Code == "CODE HERE" then
-- Code here on how to respawn, etc
end
end)

If this helped please help me out by accepting the answer. And good luck on your game!

0
Thank you! Lemme check though. Is the text button the submit thing? Cyber_gamer91 -3 — 4y
Ad

Answer this question