So this script works in studio, but it doesn't work in-game. It doesn't even print. The point of this script is to tell another server script to give a tool when a dialog choice is selected.
--This is a script, not a local script --The game is FilteringEnabled local RepService = game:GetService("ReplicatedStorage") local GiveCrateEvent = RepService:WaitForChild("Events"):WaitForChild("GiveCrate") script.Parent.DialogChoiceSelected:connect(function(player, choice) if (choice == script.Parent.Stock.ASand.AYes) then print(player.Name.." asked for a Sand Crate") GiveCrateEvent:Fire(player,"ASandCrate") end end)
The other script:
--Also a script --Located in SSS local RepStorage = game:GetService("ReplicatedStorage") local GiveCrateEvent = RepStorage:WaitForChild("Events"):WaitForChild("GiveCrate") local ServerStorage = game:GetService("ServerStorage") local CrateStorage = ServerStorage.Crates GiveCrateEvent.Event:connect(function(player, crate) local ChosenCrate = CrateStorage:FindFirstChild(crate) local CrateClone = ChosenCrate:clone() CrateClone.Parent = player.Backpack print("Gave "..player.Name .." a ".. crate) end)
I have absolutely no idea why this won't even print in-game. Any help would be appreciated. Thanks.
I'm going to make my own set of gui dialogs instead. Thanks for those who tryed to help me solve this problem. :)
Try switching to a Local Script.
--This is a script, not a local script --The game is FilteringEnabled --A choice can't be equal to DialogChoice box, a choice must equal to the DialogChoice box's name! local RepService = game:GetService("ReplicatedStorage") local GiveCrateEvent = RepService:WaitForChild("Events"):WaitForChild("GiveCrate") script.Parent.DialogChoiceSelected:Connect(function(player, choice) if choice.Name == script.Parent.Stock.ASand.AYes.Name then print(player.Name.." asked for a Sand Crate") GiveCrateEvent:Fire(player,"ASandCrate") end end)
RemoteEvents and RemoteFunctions can only send data from server to client or client to server, not server to server or client to client. A fix would be to use BindableFunctions as that is what it looks like what you are trying to accomplish. I don't see any errors in your script though, so all you need to do is change the remote function to a bindable function with no changes to your script.
Hope this helps!