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

Why wont my spawn script Work (It works with dialog s)?

ascript.Parent.DialogChoiceSelected:connect(function(player, choice)
		if p:GetRankInGroup(2672272) >= 4 then
			game.Lighting:findFirstChild(choice.Name) then
			game.Lighting:findFirstChild(choice.Name):clone().Parent = workspace
		end
	end)
end

2 comments

0

Is there any output? Also I noticed that there is a random "then" on line three but no if or end?

0

typo you put ascript.parent

1 answer

✓ Accepted answer

Your error was that there was a random then in line 4, so here is the fixed code:

ascript.Parent.DialogChoiceSelected:connect(function(player, choice)
        if p:GetRankInGroup(2672272) >= 4 then
            game.Lighting:findFirstChild(choice.Name)
            game.Lighting:findFirstChild(choice.Name):clone().Parent = workspace
        end
    end)
end

ALSO I didn't know if there was a typo in line 1 or if that was the name of the script you were calling on, so here is the fixed fixed code:

script.Parent.DialogChoiceSelected:connect(function(player, choice)
        if p:GetRankInGroup(2672272) >= 4 then
            game.Lighting:findFirstChild(choice.Name)
            game.Lighting:findFirstChild(choice.Name):clone().Parent = workspace
        end
    end)
end

1 comment

0

ascript is a mistake since in order to call on the script that has the code in it, it should be named script. If you name a script "MainCode" you still address it by "script", not "MainCode.Parent".

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