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

Studio Update ruined script, why?

Asked by 9 years ago
local passId = 253208787
function isAuthenticated(player)
    return game:GetService("MarketplaceService"):PlayerOwnsAsset(player, passId)
end

game.Players.PlayerAdded:connect(function(plr) if
    isAuthenticated(plr) then SpawnDelayTime = 0





OnDeath_Callback = function(player)

print(player.Name .. " died. Awaiting respawn.")

end






game.Players.CharacterAutoLoads = false

game.Players.PlayerAdded:connect(function(p)
p.CharacterAdded:connect(function(c)

local t = time()
while ((not c:FindFirstChild("Humanoid")) and ((time()-t) < 10)) do wait(0.2) end   

if ((time()-t) >= 10) then print("Timeout error") 


else
c.Humanoid.Died:connect(function()
if (type(OnDeath_Callback) == "function") then OnDeath_Callback(p) end
wait(SpawnDelayTime)
p:LoadCharacter(true)
end)


end
end)
wait(2)
p:LoadCharacter(true) 

I tried to fix it but it just made me do things that would worsen the state of the script. "Error: (47,1) Expected 'end'(to close 'function' at line 26),got<eof>" Please help me

1 answer

Log in to vote
0
Answered by 9 years ago

I found some errors:

  • It is game:GetService("GamePassService"):PlayerHasPass(player,id), I believe, when handling game passes. But it can be used by MarketPlaceService, which is recommended on the ROBLOX wiki.

  • You did not end the function properly on Line 6 (needs to be end)), or you didn't end the function's if statement.

  • The PlayerAdded function on Line 26 does not end properly. Here's a fix:

function OnDeath_Callback(p)
    print(p.. " has died.")
end

game.Players.PlayerAdded:connect(function(p)
    p.CharacterAdded:connect(function(c) 
        local t = time()
        while ((not c:FindFirstChild("Humanoid")) and ((time()-t) < 10)) do wait(0.2) end  
        if ((time()-t) >= 10) then
            print("Timeout error")
        else
            c.Humanoid.Died:connect(function()
                OnDeath_Callback(p)
                wait(SpawnDelayTime)
                p:LoadCharacter(true)
            end)
        end
    end)
end)

Hope I helped, there might be more bugs I didn't pick up. If it doesn't put anything in the output then use the print() debug method below:

print("ok")
local num = 5
print("ok2")
if num == 5 then
    print("ok3")
    num = 3
    if num == 6 then
        print("ok4")
    end
end

It tells you where the script stops, in this case, Line 7.

0
Look at this- http://i.imgur.com/kesNPV7.jpg iiCasual 20 — 9y
0
*facepalm* I fixed that section, so you delete all of your script on that section, and replace it with mine. Just go with a simple function name(), and don't check to see if it's a function. You can fix those basic problems if you can write the above. Sorry if I sound rude. TheDeadlyPanther 2460 — 9y
0
Make sure you keep the OnDeath_CallBack function, because that is what caused half of your problems. TheDeadlyPanther 2460 — 9y
Ad

Answer this question