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

Dialogue Gear Giver not working in-game, yet it is working in studio! How can I fix this?

Hello. I have recently been trying to make a game where once you talk to someone (using ROBLOX dialogue), it gives you an item based on your choice. Though I have run into some issues. The script is working in studio, yet not in-game. How can I fix this issue?

Script:

script.Parent.DialogChoiceSelected:Connect(function(player, choice)
	if (choice == script.Parent.Choice1) then
		local h = game.ServerStorage.Regular:Clone()
		h.Parent = player.Backpack
	end
	if (choice == script.Parent.Choice2) then
		local h = game.ServerStorage.Decaf:Clone()
		h.Parent = player.Backpack
	end
	if (choice == script.Parent.Choice3) then
		local h = game.ServerStorage.Espresso:Clone()
		h.Parent = player.Backpack
	end
end)

Script Location: http://prntscr.com/ijop70

Server Storage: http://prntscr.com/ijopdf

The game is Filtering Enabled.

If you need any extra info, feel free to message me on ROBLOX, my messages are open! https://www.roblox.com/messages/compose?recipientId=58651031

2 comments

0

try game:GetService("ServerStorage"):WaitForChild("Espresso")

0

Where? After line 10?

1 answer

✓ Accepted answer

Like @KenUSM said, you should try game:GetService, for an example. Line 11 game:GetService("ServerStorage"):WaitForChild("Espresso"):Clone().Parent = player.Backpack (Also part of the reason it might not work, is because you're using "local", as you test it in studio, you're testing in local server)

If it's in a normal script, I suggest not using local

a = game:GetService("ServerStorage")

script.Parent.DialogChoiceSelected:Connect(function(player, choice)
    if (choice == script.Parent.Choice1) then
        a:WaitForChild("Regular"):Clone().Parent = player.Backpack
    end
    if (choice == script.Parent.Choice2) then
       a:WaitForChild("Decaf"):Clone().Parent = player.Backpack
    end
    if (choice == script.Parent.Choice3) then
        a:WaitForChild("Espresso"):Clone().Parent = player.Backpack
    end
end)

(IF THIS DOES NOT WORK, then I do not know what else to say, I have one similar, but it's scripted differently.)

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