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
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.