Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Group spawn with gear item script not working?

I attempted to find a script for my game, I found this one but it kept giving me errors.

Example: Lets say you joined a 'I love cheeseburgers' group, when you spawn in their game you are geared a cheeseburger for being in the group. If you are not in that group you will not spawn with a cheeseburger.

The error occurred under 'respawned' on the 7th line.

Please help TT-TT

wait(2)

gpid = 2905610 
tools = ("170897263")

GPS = Game:GetService("GamePassService")
fuction respawned(char) -- This is where the error is
player = game.Players:FindFirstChild(char.Name)
print ("Respawned")
if char:FindFirstChild("Head") ~= nil then
	print("Player")
	if GPS:PlayerHasPass(player, gpid) then
		print("Has GPID")
		for i = 1,#tools do
			game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.Backpack
		end
	else
		print("No GPID")
	end
end
game.Workspace.ChildAdded:connect(respawned)

2 comments

0

Done, read the comment in the code.

0

That's not a script error. You should check this page and debug it yourself. http://wiki.roblox.com/index.php?title=Lua_errors

1 answer

#What you did wrong You misspelled, "function", also, tools needs to be in curly brackets because you're using it as a table.


#Final Product

wait(2)

gpid = 2905610 
tools = {"170897263"}

GPS = Game:GetService("GamePassService")
function respawned(char) -- No error!
player = game.Players:FindFirstChild(char.Name)
print ("Respawned")
if char:FindFirstChild("Head") ~= nil then
    print("Player")
    if GPS:PlayerHasPass(player, gpid) then
        print("Has GPID")
        for i = 1,#tools do
            game.ServerStorage:FindFirstChild(tools[i]):Clone().Parent = player.Backpack --Put the tools in server storage, not lighting.
        end
    else
        print("No GPID")
    end
end
end
game.Workspace.ChildAdded:connect(respawned)


Hope it helps!

1 comment

0

It says 'Asset is not approved for the requester' and isn't working still...

This discussion is preserved as it was. New answers, comments, and votes are closed.