Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Execute Button for ServerSided scripts, how do i code it?

how can i code an execute button for a serversided script executor? I was trying to teach my friends on how to use it so they dont ask me for a game that supports ServerSide scripts, and give them some.~~~~~~~~~~~~~~~~~ --1 thing I forgot to mention: I need the button to be used in a gui that can be used in EVERY game, all inside a MainModule.


3 answers

I do not understand fully what you mean. I don't know if you mean you want a button that will run a server-side script? I am very confused. If you do and you want to use GUI's, you can use events to send data to another script and then execute the function.

2 comments

0

Yes, i need a button code that runs a script like an require in an textbox above the button. I have one currently, from an tutorial, but it wont work.

0

I do not understand.

If you want to make a GUI Button that fires a event on the server and do something with that then add a Button and a local script inside it with this code:

local Button = script.Parent
local Player = game:GetService("Players").LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Event = ReplicatedStorage:WaitForChild("Event")

Button.MouseButton1Click:Connect(function()
	Event:FireServer(Player)
end)

and add a Server script in ServerScriptService with this code:

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

Event.OnServerEvent:Connect(function(Player)
	print("Event got fired by : "..Player.Name)
	-- do what ever u want
end)

and also u need to add a RemoteEvent in ReplicatedStorage

1 comment

0

1 thing I forgot to mention: I need the button to be used in a gui that can be used in EVERY game, all inside a MainModule.

--1 thing I forgot to mention: I need the button to be used in a gui that can be used in EVERY game, all inside a MainModule.

This discussion is preserved as it was. New answers, comments, and votes are closed.