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

Why do i get this weird error "expected = got local" i can't figure out why??

Asked by 5 years ago
Edited 5 years ago

Probably something I missed but plz help

local event = game.ReplicatedStorage.Touch_Collect.RemoteEvent
local running = false
local sound = workspace.Collect_Coins_Area.sound
event.OnServerEvent:Connect(function(player)
    if not running then running = true
    local pieces = player.leaderstats:WaitForChild("Pieces")
    local A = player:WaitForChild("PlayerGui").Coins.Coin.A
    local F = A player:WaitForChild("PlayerGui").Coins.Coin.F
local coins = player.leaderstats:WaitForChild("Coins")

wait(0.1)
local value = pieces.Value
coins.Value = coins.Value +value
pieces.Value = pieces.Value - value
sound:Play()
wait(5)
running = false
end
    end)
0
does the output gives the line who makes the error? Louix27626 83 — 5y
0
Yeah Freddan2006YT 88 — 5y
0
OutPut: ServerScriptService.Collect.Script:9: '=' expected near 'local' Freddan2006YT 88 — 5y

2 answers

Log in to vote
1
Answered by 5 years ago

Hi there, I did some troubleshooting and I have found the source of your problem.

You seem to have missed a dot after A on line 8:

local F = A player:WaitForChild("PlayerGui").Coins.Coin.F

^^ Yours says this

local F = A.player:WaitForChild("PlayerGui").Coins.Coin.F

^^ It should say this.

Hope that fixes it.

Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago
local event = game.ReplicatedStorage.Touch_Collect.RemoteEvent
local running = false
local sound = workspace.Collect_Coins_Area.sound
event.OnServerEvent:Connect(function(player)
    if not running then 
running = true
    local pieces = player.leaderstats:WaitForChild("Pieces")
    local A = player:WaitForChild("PlayerGui").Coins.Coin.A
    local F = player:WaitForChild("PlayerGui").Coins.Coin.F
local coins = player.leaderstats:WaitForChild("Coins")

wait(0.1)
local value = pieces.Value
coins.Value = coins.Value +value
pieces.Value = pieces.Value - value
sound:Play()
wait(5)
running = false
end
end
    end)
0
I'm not using an and and you are not supposed to put two ==. If it would look like this i would need it "If running == false then running = true"" Freddan2006YT 88 — 5y
0
ye i read ur script a bit wrong, but i was on my phone so thats not very weird either Gameplayer365247v2 1055 — 5y

Answer this question