Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Im Trying to make a twitter code script without any expiration date but its not working?

this is a local script

local player = game.Players.LocalPlayer
local RE = game.ReplicatedStorage.EnterCode --EnterCode Is RemoteEvent
local codes = player:WaitForChild("Codes")

local codelist = {
	code1 = "ROBLOX", --Test Codes
	code2 = "Yeet"
}

script.Parent.MouseButton1Click:Connect(function()
	if script.Parent.Parent.CodeHandler.Text == codelist.code1
	then
		if not codes:FindFirstChild ("Code1") then
			RE:FireServer(20, "Code1") --Rewards
			script.Parent.Text = "Code Redeemed Successfully"
			wait(2)
			script.Parent.Text = "Redeem Code"
		else
			script.Parent.Text = "Code Redeemed Successfully"
			wait(2)
			script.Parent.Text = "Redeem Code"			
		end
	else
		script.Parent.Text = "Code Expired"
			wait(2)
			script.Parent.Text = "Redeem Code"
	end
	elseif script.Parent.Parent.CodeHandler.Text == codelist.code2 then
		if not codes:FindFirstChild ("Code2") then
			RE:FireServer(20, "Code2")--Rewards
			script.Parent.Text = "Code Redeemed Successfully"
			wait(2)
			script.Parent.Text = "Redeem Code"
		else
			script.Parent.Text = "Code Redeemed Successfully"
			wait(2)
			script.Parent.Text = "Redeem Code"			
		end
	
end
	
end)

3 comments

1

i cant read the code properly unless you use code block

0

Have you added codes into the player, when the player joins the game?

0

I have added codes to the GUI to enter the codes but not to the player

1 answer

THIS IS NOT ANSWER, THIS IS HIS CODE INTO A CODEBLOCK

local player = game.Players.LocalPlayer

local RE = game.ReplicatedStorage.EnterCode --EnterCode Is RemoteEvent

local codes = player:WaitForChild("Codes")

local codelist = {

code1 = "ROBLOX", --Test Codes

code2 = "Yeet"

}

script.Parent.MouseButton1Click:Connect(function()

if script.Parent.Parent.CodeHandler.Text == codelist.code1

then

if not codes:FindFirstChild ("Code1") then

RE:FireServer(20, "Code1") --Rewards

script.Parent.Text = "Code Redeemed Successfully"

wait(2)

script.Parent.Text = "Redeem Code"

else

script.Parent.Text = "Code Redeemed Successfully"

wait(2)

script.Parent.Text = "Redeem Code"

end

else

script.Parent.Text = "Code Expired"

wait(2)

script.Parent.Text = "Redeem Code"

end

elseif script.Parent.Parent.CodeHandler.Text == codelist.code2 then

if not codes:FindFirstChild ("Code2") then

RE:FireServer(20, "Code2")--Rewards

script.Parent.Text = "Code Redeemed Successfully"

wait(2)

script.Parent.Text = "Redeem Code"

else

script.Parent.Text = "Code Redeemed Successfully"

wait(2)

script.Parent.Text = "Redeem Code"

end

end

end)

This discussion is preserved as it was. New answers, comments, and votes are closed.