Studio errors if i don’t add this end, but it doesn’t seem to be ending anything…
What is the rest of the script? I think you missed an end
somewhere above this.
end
is used to end a statement, in this case, it appears to end the if
statement plus the elseif
statement
Rest of the function, all the functions above aren’t missing an end and above that, it has only variables
@DasKairo , the end below it ends the elseif/if and the end above it ends the for i,v loop. When i compress the function, the end just disappears…
That’s strange, I’ve never seen that. Does the function compress to the last end?
Yes, it’s quite weird. I just added the for i, v part, and then the script showed an error that I was missing an end.
Can you show a picture of the compressed function?
Try to use it in line where is for loop:
for i,v in pairs(sound:GetChildren()) do
I might be wrong but I think the end is there for the "if sound:IsA("Sound)" then
Basically this:
end -- for i,v (loop)
end -- elseif
end -- if sound
end -- function end
Format the code by three backticks please, like this
```lua
Add some code here
elseif
is part of the if sound:IsA("Sound)
statement, and does not have an end
OH, my bad. I thought elseif needs an end too. Thx
The studio linter is probably confused by the one-line if not sound then return end
local function SoundPlay(sound, parent: Instance): Sound
if not (sound and parent) then return end
if sound:IsA("Sound") then
local sound = sound:Clone()
sound.Parent = parent
sound:Play()
game.Debris:AddItem(sound, sound.TimeLength+1)
return sound
else if sound:IsA("Folder") then
for i, v in sound:GetChildren() do
local sound = sound:Clone()
sound.Parent = parent
sound:Play()
game.Debris:AddItem(sound, sound.TimeLength+1)
return sound
end -- loop end
end -- what is this end for?
end -- elseif end
end -- function end
Huh. I wonder if i should bring that up as a bug
What… It thinks the else and if are seperated for some reason?
I fixed It by just changing the elseif to else, and then to elseif again… really strange bug.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.