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

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

Asked by 4 years ago

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)
0
What line is the error on? That would help out people trying to answer your question. U_srname 152 — 4y

1 answer

Log in to vote
0
Answered by
Elixcore 1337 Moderation Voter
4 years ago
Edited 4 years ago

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.

0
Thats what i did Freddan2006YT 88 — 4y
0
no, you did not put anything after 'elseif' Elixcore 1337 — 4y
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) Elixcore 1337 — 4y
0
plr.achievements.Has_Hammer.Value == true then Nothing has changed Freddan2006YT 88 — 4y
Ad

Answer this question