local dialog = script.Parent dialog.DialogChoiceSelected:connect(function(player, choice) local stats = player:FindFirstChild("leaderstats") if not stats then return local money = stats:FindFirstChild("Money") if not money then return if choice == script.Parent.DialogChoice.ChoiceA Then if money amount >= 0 then game.ReplicatedStorage.Fishingtool:clone().Parent = player.Backpack end end)
Error
13:57:56.354 - Workspace.Test Dumb.Head.Dialog.DialogScript:7: unexpected symbol near 'local'
Silly mistakes. I'll just list them off.
You forgot an end
on line 5
You forgot an end
on line 8
You forgot an end
for your event on line 2
You capitalized "then" on line 10
You didn't index Value
for "money" on line 11.
local dialog = script.Parent local tool = game.ReplicatedStorage.Fishingtool dialog.DialogChoiceSelected:connect(function(player, choice) local stats = player:FindFirstChild("leaderstats") if not stats then return end --end local money = stats:FindFirstChild("Money") if not money then return end --end if choice == script.Parent.DialogChoice.ChoiceA then if money.Value >= 0 then --index 'value' tool:Clone().Parent = player.Backpack end end end) --end
You need an end to finish the 'if' statements, and you also need to pay attention to your capitalization. Remember Lua is case-sensitive.
All 'if' statements need end's to finish them correctly. To fix it in your script, we'll simply add them in where they belong, which is at the end of the statement:
local stats = player:FindFirstChild("leaderstats") if not stats then return end local money = stats:FindFirstChild("Money") if not money then return end
You just made a simple mistake here on line 10. You need to remember to use the correct case for things like this. The 'Then' should be 'then'. Remember to pay attention to this from now on.
Ok, so here's the finished script:
local dialog = script.Parent dialog.DialogChoiceSelected:connect(function(player, choice) local stats = player:FindFirstChild("leaderstats") if not stats then return end local money = stats:FindFirstChild("Money") if not money then return end if choice == script.Parent.DialogChoice.ChoiceA then if money.Value >= 0 then game.ReplicatedStorage.Fishingtool:clone().Parent = player.Backpack end end --You also forgot this end. Remember to use indentations so it's easier to catch mistakes like this as well. end)
Ok, so now this should work for you :P
Anyways, if you have any further problem/questions, please leave a comment below. Hope I helped :P