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)

-- Make sure its a local script lol

local code = script.Parent.Parent.CodeBox
local give = game.ReplicatedStorage.giveTool

script.Parent.MouseButton1Click:Connect(function()
    if code.Text == "code" then -- if the input is code then it will fire the event 
        give:FireServer()
    else
        print("incorrect code!")
    end
end)

This will be the event

-- Put this in serverscriptservice

local give = game.ReplicatedStorage.giveTool

give.OnServerEvent:Connect(function(plr)
    local tool = game.Lighting.tools.Tool

    tool:Clone().Parent = plr.Backpack
end)
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.

local tool1 = game.Lighting.Tool1
local tool2 = game.Lighting.Tool2
local button = script.Parent.TextButton
local textBox = script.Parent.TextBox
local player = game.Players.LocalPlayer

button.MouseButton1Click:Connect (function ()
   if textBox.Text == "Put Code You Want Here" then
       tool1:Clone ().Parent = player.Backpack
elseif textBox.Text == "Another code here" then
     tool2:Clone ().Parent = player.Backpack
end
end)
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