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

How come my Dialog choice GUI shop wont work?

So I have a dialog choice where when you click choice you get a GUI that opens after the NPC's response, but it won't work at all, and the script is in a local script.

---Script---

--- Script type is a local script

script.Parent.DialogChoiceSelected.Response:Connect(function(player, choice)
	  game.player.PlayerGui.ShopGui.Frame.Visible = true
    end)

1 answer

✓ Accepted answer

Looks like there's a couple of issues, with the first thing being the way you're referencing player.

"game.player" is essentially the same thing as game.Workspace. or game.StarterGui and since "game.player" doesn't exist, your script will throw an error.

Assuming this local script is inside of the PlayersGui it should be rewritten with:

game.Players.LocalPlayer --This is how you reference your player. 

Now another issue is the fact you're using a LocalScript for an Instance that can't use LocalScripts. An easy fix to this is to put a regular Script inside of your Dialog Box, and add the following code:

script.Parent.DialogChoiceSelected.Response:connect(function(plr, choice)
	plr.PlayerGui.ShopGui.Frame.Visible = true --Plr was referenced above so no need for the 'game.'
end)

Assuming you don't have FE (Filtering Enabled) on, the script should work.

3 comments

0

I'll check

0

do i put the local script in the StarterGui or the ScreenGui?

0

You don't need a local script.

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