#Can anyone help me make a small script where if a player selects a dialog choice it removes 10 click

1 messages · Page 1 of 1 (latest)

tiny glen
#

title

#

ive tried doing it with chatgpt but it just isnt working

empty idol
#

^ show me script / video please

tiny glen
#

serverscriptservice script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")

-- make sure a RemoteEvent exists
local remote = Instance.new("RemoteEvent")
remote.Name = "DialogRemote"
remote.Parent = ReplicatedStorage

-- when fired, remove 10 clicks
remote.OnServerEvent:Connect(function(player)
local stats = player:FindFirstChild("Leaderstats")
if stats then
local clicks = stats:FindFirstChild("Clicks")
if clicks then
clicks.Value = math.max(0, clicks.Value - 10)
end
end
end)

#

starterplayerscripts script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local player = Players.LocalPlayer

local remote = ReplicatedStorage:WaitForChild("DialogRemote")

-- connect to all Dialogs
for _, dialog in ipairs(workspace:GetDescendants()) do
if dialog:IsA("Dialog") then
dialog.DialogChoiceSelected:Connect(function(p, choice)
if p == player and choice.Name == "Yes please" then
remote:FireServer()
end
end)
end
end

#

literally only need it to take 10 Clicks from the player when he selects the dialogue option.

harsh patrol
tiny glen
#

but can YOU help?

harsh patrol
#

Okay

tiny glen
#

Okay

harsh patrol
#

First of all why is it getting all dialogues

#

🥀

tiny glen
#

chatgpt is stupid. Ive been tryna give him prompts for an hour

fluid elbow
#

chatgpt stupid or you

tiny glen
#

both

wicked yokeBOT
#

studio** You are now Level 3! **studio

harsh patrol
tiny glen
#

i just want to get over with it

harsh patrol
#

Yes

tiny glen
#

ok

empty idol
# tiny glen

i mean i am not seeing if its not working, can you make it run for a sec

#

and try doing the option

tiny glen
#

sure

empty idol
#

sometimes its a stupid mistake, so if i cant understand the issue with it running i will make you put a debug print

tiny glen
harsh patrol
#

Holy freemodel

tiny glen
#

some of it

#

but we ARE swapping them out

harsh patrol
#

We?

tiny glen
#

friends

harsh patrol
#

Is there a team behind ts

#

💀

tiny glen
#

me and a friend

harsh patrol
#

Ok

tiny glen
#

so erm

#

what can i do to make it work

harsh patrol
#

Yes please is spelt wrong in the script

#

No wait nvm

#

Uh

#

🤔

tiny glen
#

🤔

empty idol
#

tbh, i have never used the dialog system in my life, where is this "choice" saved at?

tiny glen
#

idk

#

No fucking way

#

the problem was

#

Leaderstats was misspeled. It was actually just leaderstats

#

damn

#

thanks for the help everyone

tiny glen
empty idol
#

always miss them ;p

tiny glen
#

yeah

#

yep😭

harsh patrol
#

Print("works")

empty idol
#

and i havent used leaderstats in like 6 years

keen trout
tiny glen
keen trout
#

it saves and ez abusing your game

#

you want to change their data in the data store

#

then update the leaderstats using that value

#

client reads from server not the other way 🙏

tiny glen
keen trout
# tiny glen idk how😭

Today we look at a new library for easily saving player data inside of Roblox! The Profile Store library is created by the same developer of the Profile Service library, which we've used for saving our player data for so long.
Subscribe for more Roblox development tutorials!

Profile Store Dev Forum post:
https://devforum.roblox.com/t/profilesto...

▶ Play video
#

this will change your life

tiny glen
#

also @keen trout Would this tutorial work for player models?>https://www.youtube.com/watch?v=87BgDTAqvjg

Today we create the Pet Follow system in our Simulator on Roblox!

Subscribe for more Roblox Scripting Tutorials!

Free Model Assets can be obtained from my Patreon here:
https://www.patreon.com/posts/74404136

Free Pet Models:
https://devforum.roblox.com/t/free-pet-pack-28-pets/958670

Join my Patreon to support me and gain access to the Script...

▶ Play video
keen trout
#

i havent watched it but i would assume so

tiny glen
plain garden
plain garden
#

rather than going right in

#

it's ok to not know something

#

he left