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

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

Asked by 6 years ago

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

0
try game:GetService("ServerStorage"):WaitForChild("Espresso") KenUSM 53 — 6y
0
Where? After line 10? Cryptekan -3 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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.)

Ad

Answer this question