So I was following the roblox tutorial on the roblox dev website but didn't work, I tried to edit it.. Never worked, They put models instead of items in the replicated storage, so instead I put items inside rep. storage. Still nothing happened. Also it never removed my kill point when I clicked choiceA. I mean, it looked like there were nothing wrong in the code, but nothing happened.
script: local dialog = script.Parent
dialog.DialogChoiceSelected:connect(function(player, choice)
-- Check the player has a stats object
local stats = player:FindFirstChild('leaderstats')
if not stats then return end
-- And that the stats object contains a Kills member
local kills = stats:FindFirstChild('Kills')
if not kills then return end
if choice == script.Parent.DialogChoice.ChoiceA then
if kills.Value >= 1 then -- 5 is the amount of Kills you need to purchase this weapon
game.ReplicatedStorage.Spear:Clone().Parent = player.Backpack
kills.Value = kills.Value - 1 -- subtract the amount of Kills you need to purchase
end
elseif choice == dialog.DialogChoice.ChoiceB then
if kills.Value >= 10 then
game.ReplicatedStorage.test:Clone().Parent = player.Backpack
kills.Value = kills.Value - 10
end
elseif choice == dialog.DialogChoice.ChoiceC then
if kills.Value >= 15 then
game.ReplicatedStorage.test1:Clone().Parent = player.Backpack
kills.Value = kills.Value - 15
end
end
end)