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

Expected then got player, but where do i even put the "then" ?

Where do I need to then it doesn't make any sense at all. I Already put a then.

code:

wait(1)
local button = script.Parent
local RequestServer = game.ReplicatedStorage:WaitForChild("RemoteEvents").Buy_Sign
local coins = game.Players.LocalPlayer:WaitForChild("leaderstats").Coins
local plrgui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
local image = plrgui.Bought_Sign.Image
local sound = script.Parent.sound
local dzz = script.Parent:WaitForChild("dzz")
local mess = script.Parent.Parent.Parent.Parent.plr_has_item.TextLabel
	local plrname = game.Players.LocalPlayer.Name
	local Plr = game.Players[plrname]
local running = false
button.Activated:Connect(function()
	if coins.Value >=5 then
		wait(0.5)
	RequestServer:FireServer()
	sound:Play()
	image:TweenPosition(UDim2.new(0, 0,0.826, 0),"Out","Bounce",1)
	wait(3)
	image:TweenPosition(UDim2.new(-1, 0,0.826, 0),"Out","Bounce",1)
	wait(1)
	elseif
		wait(0.2)
		--animate text and play sound
		plr.achievements.Has_Hammer.Value == true then
			mess.Visible = true
			local text = "You already have this item!" 
			for i  = 1,# text do
				mess.Text = string.sub(text,1,i)
							wait(0.000001)
			end
		dzz:Play()
			wait(1)
			mess.Visible = false
			end
end)

1 comment

0

What line is the error on? That would help out people trying to answer your question.

1 answer

Line 22, elseif.

elseif needs arguments, just like if.

so it should be

elseif plr.achievements.Has_Hammer.Value == true then
wait(0.2)

instead of your version, which has the wait(0.2) before completing the elseif statement.

4 comments

0

Thats what i did

0

no, you did not put anything after 'elseif'

0

you put a wait(0.2) in between the elseif and what the argument, format it like this. elseif plr.achievements.Has_Hammer.Value == true then wait(0.2)

0

plr.achievements.Has_Hammer.Value == true then Nothing has changed

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