Hi! I am having trouble with this one piece of code:
Trigger.OnClientEvent:Connect(function()
Tween(game.Workspace.CurrentCamera, MainCam)
NPCName.Text = NPC.Name
typeMessage("Test", 1)
wait(1)
Choices:TweenPosition(UDim2.new(0.56, 0, 0.399, 0))
typeMessage("...", 0.25)
ChoiceValue.Value = ChoiceValue.Value + 1
end)
The main concern is in the last line of code, basically it will not add the number in the value. Pretty confused since I also have been doing this NumberValue thing on other stuff and it works. The code is inside a LocalScript. Thank you in advance for helping!
2 Likes
Scottifly
(Scottifly)
August 21, 2022, 7:17am
#2
Are you getting the prints in the output window?
msix29
(msix29)
August 21, 2022, 7:17am
#3
things on the client (made by local scripts) do not replicated to the server and aren’t detected by server scripts (normal scripts).
3 Likes
Well the rest of the code works, just the Adding Value is what isn’t working
Did u check the client value? also is ChoiceValue a part smthing or a value?
1 Like
ChoiceValue is a NumberValue, and I’ve also checked the client value as well, not adding
1 Like
Downrest
(Down)
August 21, 2022, 7:44am
#8
Try this out:
Trigger.OnClientEvent:Connect(function()
Tween(game.Workspace.CurrentCamera, MainCam)
NPCName.Text = NPC.Name
typeMessage("Test", 1)
wait(1)
Choices:TweenPosition(UDim2.new(0.56, 0, 0.399, 0))
typeMessage("...", 0.25)
warn("old: ", ChoiceValue.Value)
ChoiceValue.Value += 1
warn("new: ", ChoiceValue.Value)
end)
2 Likes
Didn’t change the number, still the same
2 Likes
Koiyukki
(Koyukki)
August 21, 2022, 7:47am
#10
What they wrote wasn’t suppose to change the number to my knowledge.
But have you tried my answer?
Try Value += 1
1 Like
Downrest
(Down)
August 21, 2022, 7:47am
#11
So both prints gave out the same value? That’s pretty weird.
1 Like
Downrest
(Down)
August 21, 2022, 7:49am
#12
Is there any errors in the output?
1 Like
That’s not what I mean, the thing printed out different numbers, but the value is just the same (0)
2 Likes
Nyonic
(Nyonic)
August 21, 2022, 7:53am
#14
PikachuBoy_YT:
typeMessage("...", 0.25)
its probably this never returning back to this script put the value above it and see if it works or put a print right above this and see if it prints
1 Like
I put the value above, nothing still.
1 Like
Nyonic
(Nyonic)
August 21, 2022, 7:56am
#16
then its not making it done to it you need to put prints through it until you find where its stopping or if its even working at all
maybe the first textmessage call
PikachuBoy_YT:
typeMessage("Test", 1)
try above it with a print
then one after
might even be that tween function not returning
1 Like
Downrest
(Down)
August 21, 2022, 8:00am
#17
Where are you getting this from? Are you trying to check the value of the number on the server?
1 Like
both printed aaaaaa. idk what to dooo
1 Like
I’m tyring to change the number by adding a number to the value, hence
ChoiceValue.Value += 1
Yet it still doesn’t work??
1 Like
Downrest
(Down)
August 21, 2022, 8:05am
#20
So the 'warn()'s gave different numbers, right?
Now I ask you this, where did you get this?