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

How to launch a function when dialog is picked?

Asked by
sheepposu 561 Moderation Voter
5 years ago
Edited 5 years ago

I have this normal script under the the Dialog along with choices. The choices and dialog work fine but the problem is that the function does not work. The output doesn't print anything. Can someone tell me why. Also there are no errors in output.

Script under Dialog

local dia = script.Parent
local tog = game.ReplicatedStorage.Events.Shop

dia.DialogChoiceSelected:Connect(function(player, dialog)
    print('Dialog option '..dialog..' was chosen')
    tog:FireClient(dialog.Name)
end)

Local Script under Player Gui - Recieves the remote

local tog = game.ReplicatedStorage:WaitForChild('Events'):WaitForChild('Shop')
local shop

tog.OnClientEvent:Connect(function(dialog)
    print('Remote Fired')
    shop = script.Parent:WaitForChild(dialog)
    shop.Enabled = true
end)

Also can someone please!!!!! add an option to disable StackEdit It is very inconvenient when inputing long scripts

0
Try using this in a Local Script only SerpentineKing 3885 — 5y
0
local script does not work with "DialogChoiceSelected" sheepposu 561 — 5y
0
It does, I literally have a game to do this in a LocalScript, you just cant use :FireClient() on the LocalScript, but you have to define "dia" directly by location SerpentineKing 3885 — 5y

Answer this question