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

Twitter Code Reedem?

Asked by
luc663 2
10 years ago

I'm trying to make a code that will give 50 walkspeed and 200 + life but its not work

01local box = script.Parent.Parent.TextBox
02local plr = script.Parent.Parent.Parent.Parent
03function onClick()
04 
05    if box.Text == "1337" then
06    box.Text = "Code Redeemed!"
07    wait(2)
08    box.Text = "Special Code"
09    local b = game.Players.Humanoid.WalkSpeed = 50
10    else
11    box.Text = "Wrong Code!"
12    wait(2)
13    box.Text = "Special Code"
14 
15 
16    end
17end
18    script.Parent.MouseButton1Click:connect(onClick)

Line 9 got an error, but i can't see it Please Help Me ASAP

0
If you want further advancement in Twitter Codes, go here: http://wiki.roblox.com/index.php?title=Data_store FutureWebsiteOwner 270 — 10y

5 answers

Log in to vote
6
Answered by
woodengop 1134 Moderation Voter
10 years ago

Here you added the walkspeed as a Variable and you don't want to do that. I rewrote it a bit:

01local plr=game.Players.LocalPlayer
02local chr=plr.Character
03 
04box=script.Parent.TEXT
05code=script.Parent.CODE
06function clicked()
07    if box.Text=="1337" then
08        box.Text="Correct!"
09        wait(2)
10        box.Text="Code"
11        chr.Humanoid.WalkSpeed=50
12    else
13        box.Text="nope"
14        wait(2)
15        box.Text="Code"
16    end
17end
18 
19code.MouseButton1Down:connect(clicked)

You can change the name of the Variables.

0
Why did this get downvoted :P woodengop 1134 — 10y
Ad
Log in to vote
0
Answered by
Relatch 550 Moderation Voter
10 years ago

You need to check if a code was entered, so you need to change your function. Also, you used "=" twice on line 9, so you need to get rid of your "local b" and change game.Players to just plr since you explained what it was. You also need to check if the code was redeemed or not already, which you would wanna set a value to check.

01local box = script.Parent.Parent.TextBox
02local plr = script.Parent.Parent.Parent.Parent
03local redeemed = false
04 
05box.FocusLost:connect(function()
06    if box.Text == "1337" and redeemed == false then
07        redeemed = true
08        box.Text = "Code Accepted!"
09        plr.Chracter.Humanoid.WalkSpeedSpeed = 50
10        wait(1)
11        box.Text = "Redeem Code"
12    elseif box.Text == "1337" and redeemed == true then
13        box.Text = "Already Used!"
14        wait(1)
15        box.Text = "Redeem Code"
View all 21 lines...
Log in to vote
0
Answered by 5 years ago

It is not referencing the player! Here is a fixed script.

01local box = script.Parent.Parent.TextBox
02local player = game.Players.LocalPlayer
03function onClick()
04 
05    if box.Text == "1337" then
06    box.Text = "Code Redeemed!"
07    wait(2)
08    box.Text = "Special Code"
09    player.Humanoid.WalkSpeed = 50
10    else
11    box.Text = "Wrong Code!"
12    wait(2)
13    box.Text = "Special Code"
14 
15 
16    end
17end
18    script.Parent.MouseButton1Click:connect(onClick)
Log in to vote
-4
Answered by
Muoshuu 580 Moderation Voter
10 years ago

On line nine, you have two equal signs in different locations. Lua syntax does not permit this, remove 'local b ='.

0
i'll try now luc663 2 — 10y
0
its not giving me the walkspeed luc663 2 — 10y
0
Why exactly was this downvoted twice? Muoshuu 580 — 10y
Log in to vote
-6
Answered by 10 years ago
01local box = script.Parent.Parent.TextBox
02local plr = script.Parent.Parent.Parent.Parent
03function onClick()
04 
05    if box.Text == "1337" then
06    box.Text = "Code Redeemed!"
07    wait(2)
08    box.Text = "Special Code"
09    plr.Character.Humanoid.WalkSpeed = 50
10    else
11    box.Text = "Wrong Code!"
12    wait(2)
13    box.Text = "Special Code"
14 
15 
16    end
17end
18    script.Parent.MouseButton1Click:connect(onClick)
1
Please provide information with your code and what you did to fix the code, otherwise the Asker may not benefit if they have no idea what was changed., M39a9am3R 3210 — 10y
1
Please add a Desc. Show the user's Mistakes. Show your changes. woodengop 1134 — 10y
0
what did it changed from mine? luc663 2 — 10y
0
i CAN'T add other codes?? luc663 2 — 10y

Answer this question