I need to make it so that when a certain dialogue choice is selected, the player gets some cash
1 Like
Checc for if that dialogue matches in the same manner ya checced for “Beggar”
Then, if there’s a match, fire the server usin a RemoteEvent to give the player some cash.
I’d recommend addin a debounce or cooldown of some sort so ya don’t get any spam requests for cash.
1 Like
Client
local replicated = game:GetService("ReplicatedStorage")
script.Parent.DialogChoiceSelected:Connect(function(Player,Choice)
if Choice.Name == "Beggar" then
replicated:WaitForChild("MyRemote"):FireServer()
end
end)
Server
local replicated = game:GetService("ReplicatedStorage")
local db = false
replicated:FindFirstChild("MyRemote").OnServerEvent:Connect(function(Sender)
if db == false then
db = true
Sender.Studs.Value += 5
task.wait(3)
db = false
end
end)
Try this and tell me if it works.