hey, i need help about this npc dialog. So in my game i have a leaderboard with coins inside it. so my plan is when player choose a specific dialog choice it will decreased the coins value by 5. but somehow when i try to make it, it doesnt work and i need help about the scripts and the placement of the script. Thanks!
3 Likes
I would need to see what progress you had done on the script you have
1 Like
sure!
script.Parent.DialogChoiceSelected:Connect(function(plr, choice)
print("Dialogue activate")
if choice == script.Parent then
local leaderstats = plr:FindFirstChild("leaderstats")
if leaderstats then
if leaderstats.Coins.Value == 5 or leaderstats.Coins.Value >= 5 then
leaderstats.Coins.Value -= 5
print("Decreased")
end
end
end
end)
i put the script inside the dialog choice. Pls tell me if I do anything wrong!
1 Like
Oh, the DialogChoiceSelected only fires on client, so you would need to detect that on a local script then fire a RemoteEvent to server to decrease the value of the leaderstats from server.
3 Likes
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.