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

I got a script for codes to give players items, need help adding more to it help please?

Asked by 8 years ago
Edited 8 years ago

This is the script I have, it works fine, I need help to find out how to able the player to be able to enter two or maybe more different codes, if someone could help it would be much appreciated! Find my current script below.

local gear = game.ReplicatedStorage:WaitForChild('AssaultRifle')
script.Parent.MouseButton1Click:connect(function()
    if script.Parent.Parent.Input.Text == 'Gun!' then
 gear:Clone().Parent = game.Players.LocalPlayer.Backpack
 gear:Clone().Parent = game.Players.LocalPlayer.StarterGear
 script.Parent.Parent.Input.Text = ''
 script.Parent.Parent.Text = 'Success!'
 wait(1)
 script.Parent.Text = 'Submit'
 else
script.Parent.Parent.Input.Text = ''
script.Parent.Text = 'Invalid Code'
wait(1)
script.Parent.Text = 'Submit'
end
end)

As I said this script works for the current code, but I want players to be able to enter 2 codes, (once someone helps me I'm sure I could add more on my own) I've tried to have another script with the same script but I need 2 submit buttons! Help please! :)

0
Please format your code by pressing the Lua button and placing your code in between the generated lines. Sublimus 992 — 8y
0
Oh thanks, done it now :) stethepea16 5 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago
local gear = game.ReplicatedStorage:WaitForChild('AssaultRifle') 
local gear1= game.ReplicatedStorage:WaitForChild(' ')
script.Parent.MouseButton1Click:connect(function()
 if script.Parent.Parent.Input.Text == 'Gun!' then 
gear:Clone().Parent = game.Players.LocalPlayer.Backpack 
gear:Clone().Parent = game.Players.LocalPlayer.StarterGear 
script.Parent.Parent.Input.Text = '' 
script.Parent.Parent.Text = 'Success!'
wait(1) 
script.Parent.Text = 'Submit' else 
script.Parent.Parent.Input.Text = '' 
script.Parent.Text = 'Invalid Code' 
wait(1) 
script.Parent.Text = 'Submit'

if script.Parent.Parent.Input.Text == 'gear1' then 
gear1:Clone().Parent = game.Players.LocalPlayer.Backpack 
gear1:Clone().Parent = game.Players.LocalPlayer.StarterGear 
script.Parent.Parent.Input.Text = '' 
script.Parent.Parent.Text = 'Success!'
wait(1) 
script.Parent.Text = 'Submit' else 
script.Parent.Parent.Input.Text = '' 
script.Parent.Text = 'Invalid Code' 
wait(1) 
script.Parent.Text = 'Submit'

end
end 
0
This doesn't seem to work, for some reason when I add this not even the first item doesn't work now. Anything else i could try? stethepea16 5 — 8y
0
make sure lines 1 (and other gear names) are matched where you have them like "gafhasfkh" would have to be "gafhasfkh" excatly AwesomeSauce666556 0 — 8y
Ad

Answer this question