I edited the script but it didn't work so here's the new script( I rewrited the question because I thought that noone will reply still if I edited the old one)
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
local KOs = stats:FindFirstChild('KOs')
)') if not KOs then return end
if choice == script.Parent.DialogChoice.Throwing BOMB then
if KOs.Value >= 10 then
game.ReplicatedStorage.Weapon1:Clone().Parent = player.Backpack
KOs.Value = KOs.Value - 10
end
elseif choice == dialog.DialogChoice.Darkheart then
if KOs.Value >= 100 then
game.ReplicatedStorage.Weapon2:Clone().Parent = player.Backpack
KOs.Value = KOs.Value - 100
end
elseif choice == dialog.DialogChoice.Heat seeking missile launcher then
if KOs.Value >= 500 then
game.ReplicatedStorage.Weapon3:Clone().Parent = player.Backpack
KOs.Value = KOs.Value - 500
end
elseif choice == dialog.DialogChoice.Red scythe then
if KOs.Value >= 50 then
game.ReplicatedStorage.Weapon5:Clone().Parent = player.Backpack
KOs.Value = KOs.Value - 50
end
elseif choice == dialog.DialogChoice.Knife then
if gold.Value >= 100 then
game.ReplicatedStorage.Weapon4:Clone().Parent = player.Backpack
gold.Value = KOs.Value - 100
end
end
end)
I want a fixed script

7 comments
Can you please format your script well ? So It's atleast readable 100%?
ok
("I want a fixed script") First, This is not how scripting helpers works. We tell you what you did wrong, you fix it. Second, you have not provided any details of what you expect the script to do and what it is actually doing. You need to provide more details about what is happening and what you want to happen.
ok
I'm actually a noob to scripting
I see quite a few errors that should show up in the output. Try looking there
I did theres no error in the output