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

Dialog shop script not working even though nothing is wrong in the script?

Asked by
Rdumb1 4
5 years ago

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)

link: https://developer.roblox.com/articles/Shop-Dialogs

0
Consider using code block. Makes us more likely to take the time to read your code. BlueGrovyle 278 — 5y
0
code block is umm.. pretty hard for me, there's no code block option. Rdumb1 4 — 5y

Answer this question