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

Why doesn't this dialogue-shop work correctly?

Asked by 6 years ago
local ServerStorage = game:GetService("ServerStorage")
local Weapons = ServerStorage:WaitForChild("ServerWeapons")

local function GiveWeapon(weapon, player)
    Weapons[tostring(weapon)]:Clone().Parent = player:WaitForChild("Backpack")
    print'cloned'
end

script.Parent.DialogChoiceSelected:Connect(function(player, choice)
    print'selected'
    if tostring(choice) == "Choice1" then
        GiveWeapon("AK74u", player)
    end
    if tostring(choice) == "Choice2" then
        GiveWeapon("TEC9", player)
    end
    if tostring(choice) == "Choice3" then
        GiveWeapon("Glock 17", player)
    end
    print'ran'
end)

No errors print out, it's a ServerScript, and everything works in Studio but not in-game. Any ideas?

0
Try putting prints at the dialog choices, and see if they print when you select said choice. Gey4Jesus69 2705 — 6y

Answer this question