How to make a chat command to get a tool and how to make a tool to open gui when equipped?

hey there developers i am working on a game but i am new to scripting so i have a lots of problems when it comes to scripting.

question1: how to make a chat command to get a tool?

so basically i want to make a chat command

Give Universal Remote

i want whenever a player types the chat command he/she will get a tool .

question2: How to make a tool that opens a GUI with buttons that covers the whole screen?

so i want after the gets the tool using chat commands ,when he /she equips it or uses it a screen GUI will appear with 7 buttons
(5 buttons in circle and 1 button in the middle,1 button in the top right corner just like a tv remote)
and whenever the player touches a button(6buttons) he/she will teleport to a location inside the world
and the 7th button in the top right corner will be the power button which will unequip the tool

IMG_20220326_161640

IMG_20220326_161618

1 Like

Have you attempted to script anything you’ve said? It might be better to at least attempt to code this before trying to ask for help. If you just ask for scripts, you won’t truly understand what’s going on. If you were to try and understand the documentation and try it out yourself, it’d be much easier to understand.

Here is a basic chat command script:

game.Players.PlayerAdded:Connect(function(plr) -- plr joins
	plr.Chatted:Connect(function(msg) -- plr chats
		if string.lower(msg) == "give universal remote" then -- make it not case sensitive
			local tool = game.ServerStorage.Tool:Clone() -- clone tool
			tool.Parent = plr.Backpack -- give it to the player
		end
	end)
end)

Here is a basic make a UI appear when you equip the tool:

local plr = game.Players.LocalPlayer

script.Parent.Equipped:Connect(function() --detect when equip
	plr.PlayerGui.ScreenGui.Frame.Visible = true -- make visible
end)

script.Parent.Unequipped:Connect(function() -- detect when unequiped
	plr.PlayerGui.ScreenGui.Frame.Visible = false -- make invis
end)
3 Likes

Same as the guy above, also make sure to have the tool inside the serverstorage or the script won’t work.

2 Likes

I understood what you said but i am much of a builder and not a scripter, but i am trying to learn lua but I don’t know exactly where I can learn it.
All of the roblox dev on YouTube actually write the lua than rather explaining about it.

And First of all Thank @alphadoggy111 @Epixerty I’ll check the codes and then I’ll mark the solution, :grin:

Ohk.
The First Script will go inside server script service or replicated first

I have one doubt
The tool will be in the server storage and the the script will go inside the tool, but should i insert it as a independent component of the tool or as the child of the GUI?

this script should be inside the serverscriptservice

and this one inside the tool

1 Like