#Why wont this work?
1 messages · Page 1 of 1 (latest)
Explain a little more pls
It looks correct on the script side
you might have to use waitforchild
on the local script
for the event
ReplicatedStorage:WaitForChild("Convert"):FireServer()
like this?
yeah try it
ReplicatedStorage:WaitForChild(“Convert”
lol just have another variable for the event I didn’t even notice that
Are you firing from the client?
and check output
yes
Put the reference of ur event as a variable
in your server side script put player between the brackets
you click the button and it converts Points to PD. on the vid the bottom one is Pd and top is Points
oh so if you want individual player's points to convert into PD you need to use player
its for whole server
oh i see
like this?
are there any prints?
did you try this?
like this?
no
its on the server side
this local
you have to do that in the server script
where?
inside the function( {here} )
?
yes like that
still does not work
if this is located in a screengui you should use a server script and parent the player
to prevent remote abuse from exploiters
add :WaitForChild()
for the variables at the tap
top*
they might not have loaded in before u called them
since its a server script
where? ```local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Convert = game.ReplicatedStorage.Convert
local Points = game.ReplicatedStorage.Stats.Points
local PD = game.ReplicatedStorage.Stats.PD
Convert.OnServerEvent:Connect(function(Plr)
print("Converted")
PD.Value = Points.Value / 10
Points.Value = 0
end)```
** You are now Level 7! **
how is the script supposed to work
i see that ur calling the variables in replicated storage
on the server
also why do you define replicatedstorage and do game.replicatedstorage
but u fire the conversion on the client
** You are now Level 1! **
when the button clicked
idk
game.replicatedstorage is fine but
what im seeing is
the data from the client isnt being sent over to the server
it fireserver
send your localscript code
local Convert = game.ReplicatedStorage.Convert
script.Parent.MouseButton1Click:Connect(function()
print("Convert sent")
ReplicatedStorage:WaitForChild("Convert"):FireServer()
end)```
ur code is wrong because
when the client sends a fireevent
the server tries to calculate it on the server
but the client data is different from the server data
and client data doesnt update to the server without calls
...
u need to send the calucation value through fireserver
example
local val = 1
event:FireServer(val)
** You are now Level 2! **
then u can do
uhm how?
event.OnServerEvent:Connect(function(value)
print("value from client is: "..val)
end)
@fresh harbor is point an integer value or a number value?
if you dont know how to send data between clients i would recommend looking up a tutorial on how remote events work
do another clip and show the output
client to server*
...
just do a clip and show output
its gonna print 0
the isuse hes having is hes trying to calculate client data from the server
if u want the data to update on the server u have to fire that data through a remote event
even if the value is stored in replicated storage
client values are different from server values
...
u do know
that you change the values
from the server
not ur own client
lets start from 0 @fresh harbor
what is PD and Points
...
Local script in workspace? That's wrong
show the points
Is that the client script to click the button?
bruh
put script in starter gui
its not in gui
put the local script
screengui*
Well, you can't use local scripts in workspace
ok test
Yeah but there is a problem
but change script.Parent.MouseButton1Click
You need to reference your ui
like local gui = game.Workspace.Part.SurfaceGui
But name the part different because there are alot of parts named "part"
Oh i'm dumb he already did
Yeah
local Convert = game.ReplicatedStorage.Convert
local Button = Workspace:WaitForChild("Screen1").SurfaceGui.TextButton
Button.MouseButton1Click:Connect(function()
print("Convert sent")
ReplicatedStorage:WaitForChild("Convert"):FireServer()
end)```
do variable
I forgot frame
but do variable
You need to send pd aswell
Yeah, i mean you want to use pd value right?
yes?
So you do the same thing you did here, but instead you need to put .Value at the end of Points and Pd in the variables
And then in fireserver(Points,PD)
It's in the client, not the server script
You forgot to put .Value in the points and pd variable at the end of them, also the pd variable is points, is that on purpose?
@glad ermine @hollow hamlet @shell oxide @scarlet bear thanks for the help