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

How to make codes to give u weapons if u write something?

Asked by
TNTIsLyfe 152
5 years ago
Edited 5 years ago

Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.

I need help with my friends game we both work on it together and we are trying to make game codes like in sims where u can redeem them for stuff. i have looked on the wiki but there are no tutorials or anything for it so i thought u could help me. also which script i use local or reg

0
please format your question better using the formatting tools Wiscript 622 — 5y
0
if you're writing in chat then you would be stepping in something similar to Admin Commands but if it's a text box then it's somewhat similar but not really ryan32t 306 — 5y

3 answers

Log in to vote
0
Answered by 5 years ago

I would start by making a folder that has the tools inside then start making the gui that gives the weapon. So I would do this.

This would be the button script in your gui (specifically the submit code button)

01-- Make sure its a local script lol
02 
03local code = script.Parent.Parent.CodeBox
04local give = game.ReplicatedStorage.giveTool
05 
06script.Parent.MouseButton1Click:Connect(function()
07    if code.Text == "code" then -- if the input is code then it will fire the event
08        give:FireServer()
09    else
10        print("incorrect code!")
11    end
12end)

This will be the event

1-- Put this in serverscriptservice
2 
3local give = game.ReplicatedStorage.giveTool
4 
5give.OnServerEvent:Connect(function(plr)
6    local tool = game.Lighting.tools.Tool
7 
8    tool:Clone().Parent = plr.Backpack
9end)
0
uh i dont understand where am i supposed to put the tool name and if im supposed to change givetool TNTIsLyfe 152 — 5y
Ad
Log in to vote
0
Answered by
Uluomis 32
5 years ago

This for a GUI in specific. In the gui have a textbox and a textbutton at the ready. Then just make a local script with this and put it in the gui. Then put the tool you want to give in lighting.

01local tool1 = game.Lighting.Tool1
02local tool2 = game.Lighting.Tool2
03local button = script.Parent.TextButton
04local textBox = script.Parent.TextBox
05local player = game.Players.LocalPlayer
06 
07button.MouseButton1Click:Connect (function ()
08   if textBox.Text == "Put Code You Want Here" then
09       tool1:Clone ().Parent = player.Backpack
10elseif textBox.Text == "Another code here" then
11     tool2:Clone ().Parent = player.Backpack
12end
13end)
0
that wouldnt really work with FilteringEnabled theking48989987 2147 — 5y
Log in to vote
0
Answered by
TNTIsLyfe 152
5 years ago

ty Uloamis for the answer this really helps

0
One more thing how would u make it so that the player cant enter the same code multiple times? TNTIsLyfe 152 — 5y
0
And also how would u make the code item save if u die TNTIsLyfe 152 — 5y
0
Use leaderstats emervise 123 — 4y

Answer this question