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
9 years ago

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


local box = script.Parent.Parent.TextBox local plr = script.Parent.Parent.Parent.Parent function onClick() if box.Text == "1337" then box.Text = "Code Redeemed!" wait(2) box.Text = "Special Code" local b = game.Players.Humanoid.WalkSpeed = 50 else box.Text = "Wrong Code!" wait(2) box.Text = "Special Code" end end 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 — 9y

5 answers

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

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

local plr=game.Players.LocalPlayer
local chr=plr.Character

box=script.Parent.TEXT
code=script.Parent.CODE
function clicked()
    if box.Text=="1337" then
        box.Text="Correct!"
        wait(2)
        box.Text="Code"
        chr.Humanoid.WalkSpeed=50
    else
        box.Text="nope"
        wait(2)
        box.Text="Code"
    end
end

code.MouseButton1Down:connect(clicked)

You can change the name of the Variables.

0
Why did this get downvoted :P woodengop 1134 — 9y
Ad
Log in to vote
0
Answered by
Relatch 550 Moderation Voter
9 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.

local box = script.Parent.Parent.TextBox
local plr = script.Parent.Parent.Parent.Parent
local redeemed = false

box.FocusLost:connect(function()
    if box.Text == "1337" and redeemed == false then
        redeemed = true
        box.Text = "Code Accepted!"
        plr.Chracter.Humanoid.WalkSpeedSpeed = 50
        wait(1)
        box.Text = "Redeem Code"
    elseif box.Text == "1337" and redeemed == true then
        box.Text = "Already Used!"
        wait(1)
        box.Text = "Redeem Code"
    else
        box.Text = "Code Declined!"
        wait(1) 
        box.Text = "Redeem Code"
    end
end)
Log in to vote
0
Answered by 4 years ago

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

local box = script.Parent.Parent.TextBox
local player = game.Players.LocalPlayer
function onClick()

    if box.Text == "1337" then
    box.Text = "Code Redeemed!"
    wait(2)
    box.Text = "Special Code"
    player.Humanoid.WalkSpeed = 50 
    else
    box.Text = "Wrong Code!"
    wait(2) 
    box.Text = "Special Code"


    end
end
    script.Parent.MouseButton1Click:connect(onClick)
Log in to vote
-4
Answered by
Muoshuu 580 Moderation Voter
9 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 — 9y
0
its not giving me the walkspeed luc663 2 — 9y
0
Why exactly was this downvoted twice? Muoshuu 580 — 9y
Log in to vote
-6
Answered by 9 years ago
local box = script.Parent.Parent.TextBox
local plr = script.Parent.Parent.Parent.Parent
function onClick()

    if box.Text == "1337" then
    box.Text = "Code Redeemed!"
    wait(2)
    box.Text = "Special Code"
    plr.Character.Humanoid.WalkSpeed = 50
    else
    box.Text = "Wrong Code!"
    wait(2) 
    box.Text = "Special Code"


    end
end
    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 — 9y
1
Please add a Desc. Show the user's Mistakes. Show your changes. woodengop 1134 — 9y
0
what did it changed from mine? luc663 2 — 9y
0
i CAN'T add other codes?? luc663 2 — 9y

Answer this question