#Client and server
1 messages · Page 1 of 1 (latest)
Help help
YO
so uhm i need help with my quest thingy
its not updating live
and gpt is useless af
no one knows what u mean
so the quest thing i did dont update live
send script and more info cuz what u mean quest thing bro
tried to make a quest system wait lemme send u
alr
but sounds like you need to use remote events, here is a little thing i wrote out for someone to learn off but you can prob use it to learn as well
client to server:
-- (local/client script)
local remote = game.ReplicatedStorage:WaitForChild("RemoteEvent")
remote:FireServer() -- no value passed, just the player because this is a local (client) script, though you could put "player" if you wanted but you dont need to, this honestly might just create 2 player values if i recall correctly lol
results in the server script:
-- server script
local remote = game.ReplicatedStorage:WaitForChild("RemoteEvent")
remote.OnServerEvent:Connect(function(player) -- need to put something here to assign the value
print(player) -- will print the player
end)
---------------
server to client:
-- (server script)
local remote = game.ReplicatedStorage:WaitForChild("RemoteEvent")
remote:FireClient() -- no value is being passed, it will by empty/nil unless we actually add in a value there
results in the local/client script:
-- local/client script
local remote = game.ReplicatedStorage:WaitForChild("RemoteEvent")
remote.OnClientEvent:Connect(function(player) -- need to put something here to assign the value
print(player) -- will NOT print the player because in the server script we lef it blank, this will print "nil"
-- in order to pass the player from a server to client/local script we have to connect the player to the player value AND pass it in the arguements() when firing
end)
Module
local QuestData = {
[1] = {
Name = "Train Your Strength",
Stat = "Strength",
Goal = 1000,
Reward = {Yen = 500, Multiplier = 1},
Description = "Train your Strength to get stronger.",
Dialogue = {
"Welcome, young fighter!",
"Your first challenge is to train your Strength.",
"Gain 1000 Strength and return to me."
}
},
[2] = {
Name = "Train Your Sword",
Stat = "Sword",
Goal = 500,
Reward = {Yen = 1000, Multiplier = 2},
Description = "Hone your sword skill!",
Dialogue = {
"Well done on your Strength!",
"Now, focus on mastering your Sword skill.",
"Gain 500 Sword and return to me."
}
},
[3] = {
Name = "Train Your Chakra",
Stat = "Chakra",
Goal = 300,
Reward = {Yen = 1500, Multiplier = 2},
Description = "Focus your mind and gain Chakra.",
Dialogue = {
"Impressive, you are growing stronger!",
"Next, channel your energy to gain 300 Chakra."
}
}
}
return QuestData
the server and local is too long-
can i send in pastebin instead?
you can send msg as file using discord
thank u
idk why the counter is not going up live.
** You are now Level 2! **
so what is the specific issue tho :")
what is this counter
uhm
i need more info 
like yk
lets say
0/300 when i train , the counter doesnt go up
like it stays 0/300
doesnt update
i did
also you have a empty ref here and likely that has a red line under it
[sending pic]
i fixed it with gpt until there were no errors and it still dont work 😭
gpt 
but there was this line tho-
12:11:31.438 Players.Iceyy_Hanss.PlayerScripts.Quest:116: attempt to compare nil < number - Client - Quest:116
shhhh
do yk any scripting
not at all lol js those basic making leaderstats and shit
i dont wanna fix ai scripts
maybe i can help you make one
;-;
ai is defo not made to write entire code, when it does its sh*t and doesn't work 90% of the time
it can be good for given direction and asking questions about coding but... thats really it
and from the looks of it, it doesn't seem to be simple leader stats or simple scripting (in my definition) ai could defo code a button for you but not this
with that script out of mind, what are you trying to do? i know you said leader stats, but that can look different for everyone
okay so im trying to make a quest system, Train chakra/strength/sword/durability and all those shit all the stats are stored in a Stats folder to get rewards/curencies like yen/sword or anything like that ykwim?
yeah i kinda follow, do you have a premade folder or does a script make it for the player when they join?
yes
it is already premade for everyone
so everyone who joins has it
idk i feel like i should send u the hiechery for my shit but idk is that alright with u?
and like to get the quest they must click on Madara(which is in workspace inside of madara has a Clickbox and then the clickdetector is inside
yeah thats fine
is madara an npc..?
ye
** You are now Level 3! **
once Madara is clicked the dialogue frame appears and under the Main as u can see theres a Text that label should be the one saying the dialogues ykwim and the the NPCName u see the one saying Madara [1/6] should display the npc name and how many slides/whichslide the player is on
ykwim
or are u stuck-
so first off are we handling the dialogue coding first? im trying to break this down lol, or do you have that code finished
we can start with Clicking on madara and the dialogue shows up- if thats okay with u
and btw the quest progression should be here-
alrighty fine with me :D and is this a one player quest? or a group thing
probably sounds silly but gotta make sure 😭
one group 😭
group quest..?
never heard of it
as in uhhh is this quest for just one player
nono
i understand
i meant
ive never seen a game done group quest
sometimes theres games that will have a quest for your team, that kind of deal yk
ok anyway 😭 if this is where the speaking text will be, id suggest naming it something like 'dialogue_text' or something
yes and done
do you want them to click on the npc's body/model with their mouse/finger or maybe a proximity prompt, or maybe even a on-screen button?
inside of the npc already have a Clickbox.clickdetector
so once they click the clickbox it should work-
as long as there is nothing in the way then click detector should be fine, personally i use proximities BUT we can do the detector if you want lol
lol tyty
sorry these questions are prob annoying but can i see where the click det is
whats the billboard gui 🤔
Just use the property changed value connection or sum o rsum 
Uh yesyes that is correct but i cover the entire avatar
okurs im assuming it wont make much difference mine covers them as well
whtas even the problem, just asking 💔
local scripts dont work in the workspace, so we can either slap a server script that will do a remote event or a local script in the player scripts, but i think remote event is better
we starting fresh cuz that script as all ai throw up
even with AI throw up, aslong as he understands the process of it and so on and so forth, it is still fixable.. just a bit tedious
, else yeah start from fresh
go take a gander
wha i do im js stuck
everything good?
anyway we can go the remove even route, because i think it's better, i suggest reading this so you know the works behind it :D
already did ive saved that to my note cuz thats actually understandable 
** You are now Level 4! **
yay glad to hear it
sorry for the waits
npnp
since we are doing a remote, you can go ahead and add a remote even object under rep storage, this is usually where most people put theirs,, you can even sort them using folders but you'd have to update the code because you'd be changing the path to your remote event object
i named mine NPC_Activated :>
i know that- but tysm for telling xd it ill follow what u name
yes to your previous msg lol
anyway-
then a server script can go under your click det, you can use a mouse click function for detecting mouse clicks
local remoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("NPC_Activated") -- used to fire to the client, like a signal, think of this as a satalite
-- you can also refrence your click det' but since it a parent, i wouldn't bother
script.Parent.MouseClick:Connect(function(activator) -- activator is the player
-- note player vs player's model are different :D
end)
visual ^
screenshot code if you prefer to follow that one instead:
local re = game:GetService("ReplicatedStorage"):WaitForChild("NPC_Activated") -- used to fire to the client, like a signal, think of this as a satalite
script.Parent.MouseClick:Connect(function(activator) -- activator is the player
warn(activator, "clicked!") -- yay wow so cool
local exampleInfo = "You just passed over info!"
-- we need a local script, so lets make sure our local script knows
-- the it has been activated and should be doing it's cool code stuff now
re:FireClient(exampleInfo) -- anything in side the () is the info we are passing over
-- since we are about to work in a local script, we dont really need activator to be passed over because
-- we can get the player using a local script with ease unlike server scripts
-- if this was client(local) to server then we would want to pass over the player(activator) because getting
-- the local player in a server script can be a huge pain sometimes because while a client(local) script "sees"
-- just the target player, the server script "sees" all players
end)
you can even test this, if you used the screenshot code, it should print orange text that says "[your name] clicked!"
oh dang
well lmk if you need to go to bed, but i suggest putting your local script in the gui, i badly replicated your gui lol
local re = game:GetService("ReplicatedStorage"):WaitForChild("NPC_Activated")
re.OnClientEvent:Connect(function(info) -- if we passed info, we'd want to refrence it inside the ()
print(info) -- this should print "You just passed over info!", just for example, we don't need this for the script!
-- make sure the above prints!!!
end)
waitt scratch that
hmm
wait
@open oriole
why dont i join ur studio and add the frames there- so yk we woundt clash later or smth ykwim
if thats okay w u lol
so i forgot that there NEEDS to be some sort of value passed over even if we dont use it, so in the
re:FireClient(activator, exampleInfo)
since it's passing to a local script the first value will be exampleInfo
updated:
-- server script under the click det'
local re = game:GetService("ReplicatedStorage"):WaitForChild("NPC_Activated") -- used to fire to the client, like a signal, think of this as a satalite
script.Parent.MouseClick:Connect(function(activator) -- activator is the player
warn(activator, "clicked!") -- yay wow so cool
-- we need a local script, so lets make sure our local script knows
-- the it has been activated and should be doing it's cool code stuff now
local exampleInfo = "you have passed over info!"
re:FireClient(activator, exampleInfo) -- anything in side the () is the info we are passing over
-- since we are about to work in a local script, we dont really need activator to be passed over because
-- we can get the player using a local script with ease unlike server scripts
-- if this was client(local) to server then we would want to pass over the player(activator) because getting
-- the local player in a server script can be a huge pain sometimes because while a client(local) script "sees"
-- just the target player, the server script "sees" all players
end)
and
-- local script inside the gui
local re = game:GetService("ReplicatedStorage"):WaitForChild("NPC_Activated")
re.OnClientEvent:Connect(function(info) -- if we passed info, we'd want to refrence it inside the ()
-- this is a local script so we dont need to add the player(activator)
-- if we was to add activator to our () above it would be nil
warn(info) -- this sound print "you have passed over info!"
end)
it's okay, i dont need it :>
im trying to help you understand so im sorry if im confusing you 🙏 i just dont wanna be the type to throw free code at you and you learn nothing 
nono i understand
its okay
i rlly wish i got someone like u whos willingly teaching me
should be smthn like dis btw lol
but like i told u i havent got any sleep and i cant sleep cuz my brain wouldnt let me if i havent finished yet 😭 and maybe after finishing u could teach me more
yessir
-- removed uneeded code from before, this is the client(local) script that is inside your gui
local re = game:GetService("ReplicatedStorage"):WaitForChild("NPC_Activated")
local db = true
-- this is like a cooldown, debounce works with true/false (bool) values
--rather than a number-based cooldown (countdown to end)
local questGui = script.Parent
re.OnClientEvent:Connect(function()
if db == true then-- if it's true, then the code inside will run!
db = false -- setting it to false means if we trigger the 'OnClientEvent' function again
-- the code inside here wont trigger, only when db is true
-- we will set the db to true again when we are done runnning our code
--lets simply enable the ScreenGui
questGui.Enabled = true
end
end)
i assumed you're wanting the gui to appear via screenGui.enabled/disabled, but let me know if its different
uh. nooo
is it frame visibility?
oki you can just do
questGui:WaitForChild("TheFrameYouWant").Visble = true
is the the 'main' frame or 'dialogue' frame? just so that mine is accurate
*Visible btw lol
worked so far? so that we dont have to backtrack to errors lol
** You are now Level 5! **
yipee so now the gui appers
did you want a type-writer effect for the npc or will the text just be there
e typer? 🤔
yesyes hehe
do we mean the same thing 
yessirr
now i introduce callable functions >:))
don't use this yet, just read
local function typeWriterEffect(text, textLabel) -- this is a bit complex for starters so don't worry if you don't grasp it right now
-- we can set what the text and textLabel mean when we call the function
textLabel.Text = " " -- setting the text empty first, or we'll only be adding text
-- if you want a sound, like a bleep sound that plays every time a letter appears let me know :D
local charIndex = 1 -- how many letters will appear at a time
local typingSpeed = 0.05 -- typing speed :>
local function updateText()
-- Get the current text
local currentText = textLabel.Text
-- if reached the end of the text..
if charIndex > #text then
-- stop updating the text
return
end
-- update the text by adding the next letter
textLabel.Text = currentText .. string.sub(text, charIndex, charIndex)
-- addd the character index (simple math)
charIndex = charIndex + 1
-- wait for the [typing speed] amount of time before the next letter
task.wait(typingSpeed)
end
-- repeat the function until the text is over :>
while charIndex <= #text do
updateText()
end
end
to call it id do
local myTextLabel = blah.blah.blah
typeWriterEffect("this is my text", myTextLabel)
when calling it, and adding info in the () you're setting references for the (text, textLabel)
basically its like doing:
local text = "this is my text"
local textLabel = blah.blah.blah
lmk if that makes sense lol
if you ever heard of modules, this is very very similar, honestly making this a module would mean you can call it anywhere in any script :>
find a sound you want, but keep in mind it plays with every letter so you'd want something short lol
lemme find one i used, if you want to hear it (found it on rblx store)
lemme hear
it honestly might be from undertale lol
https://create.roblox.com/store/asset/73111256884318/Whelen-295SLSA1-HORN?keyword=short+low+chat+beep+undertale&pageNumber=1&pagePosition=0
for female npcs i would make the pitch higher (via pitch)
wait thats 100% thw wrong one
maybe it was this one 🤔 you can always make the pitch lower
https://create.roblox.com/store/asset/929615246/Undertale-Flowey-Talk-Normal?keyword=undertale&pageNumber=1&pagePosition=16
i make a talking npc for a game's previous map but they made a new map and deleted the place so i have no way to see the sound now lol
hm actually thats nice
oh
what was the game abt
capturing children /j
tiny rigs run around and you capture them with nets 💀 i would joke and say out of context this sounds horrible
nah u woked for a P
noo 😭
lmfaooo
it wasnt a creepy game i swear lol
i was like "guys this lowk seems like a kidnapping game"
put that in your portfolio lets see what people say then 💀
the little rigs are devs, or popular youtubers
HAHAAH
lemme show u one of their old images rq
bet
hey commissioned this but i think they got scammed ngl cuz this might be ai
and the other guy isnt even small </3
i cant show a lot but i made nets but i dont do good cartoony styles so it reasonably got rejected lol this one was space themed
im more of a realistic-ish like old graphic games
damn.
i do a little bit of everything because i dont work well with other people loll
i assist that net game but i used to script for them but they hired a ton others and i tried to work with them but uhhh i just cant lol
id ask u to join me lol but idt u wld
oh.
the only thing i cant do at all is visual effects
i havent even hired anyone only one is a modeler but that was it
plus lowk it seems like everything i made for them just ends up getting scrapped but that happens in development so im not super mad but ykk a little sad
eh
why
wait can we talk abt this more in dms and abt the dev here cuz i wanna talk smth private too xd
im making a game rn, using it as a learning experience :> ive gotten 10x better at building lol
shore
print(player.Name) not print(player)
brother it prints the same
really? never knew that lol
yeah not worth the extra 5 characters lol
player will print as the name regardless, like if you were to print a block it will print the name of the block
ngl for a second i was like "tf?" like aint no way i need to add .name so i loaded up studio
lol
