#Why wont this work?

1 messages · Page 1 of 1 (latest)

fresh harbor
#

im trying to make a button that converts Points to PD.

hollow escarp
#

Explain a little more pls

fresh harbor
#

these are the same

#

and this is the same

#

@hollow escarp does that help?

hollow escarp
#

It looks correct on the script side

karmic hedge
#

on the local script

#

for the event

fresh harbor
#

uhm

#

how?

#

im new

hollow escarp
#

Yeah but would it not load later?

#

Oh wait ig ur right

karmic hedge
fresh harbor
#

like this?

karmic hedge
#

yeah try it

hollow escarp
#

ReplicatedStorage:WaitForChild(“Convert”

#

lol just have another variable for the event I didn’t even notice that

karmic hedge
#

yeah i think its more efficient

#

put print statements

scarlet bear
karmic hedge
#

and check output

fresh harbor
hollow escarp
#

Put the reference of ur event as a variable

karmic hedge
#

how is this supposed to work

scarlet bear
fresh harbor
#

you click the button and it converts Points to PD. on the vid the bottom one is Pd and top is Points

karmic hedge
#

oh so if you want individual player's points to convert into PD you need to use player

fresh harbor
#

its for whole server

karmic hedge
#

oh i see

fresh harbor
karmic hedge
scarlet bear
scarlet bear
karmic hedge
fresh harbor
scarlet bear
fresh harbor
#

where?

karmic hedge
fresh harbor
scarlet bear
#

yes like that

fresh harbor
#

still does not work

shell oxide
#

to prevent remote abuse from exploiters

fresh harbor
#

not rn

#

im trying to just make this work first

shell oxide
#

for the variables at the tap

#

top*

#

they might not have loaded in before u called them

#

since its a server script

fresh harbor
#

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)```

shrewd pathBOT
#

studio** You are now Level 7! **studio

shell oxide
#

how is the script supposed to work

#

i see that ur calling the variables in replicated storage

#

on the server

scarlet bear
#

also why do you define replicatedstorage and do game.replicatedstorage

shell oxide
#

but u fire the conversion on the client

shrewd pathBOT
#

studio** You are now Level 1! **studio

fresh harbor
#

when the button clicked

shell oxide
#

game.replicatedstorage is fine but

#

what im seeing is

#

the data from the client isnt being sent over to the server

fresh harbor
shell oxide
#

and client data doesnt update on the server

#

due to filtering enabled

fresh harbor
#

its not sending data

#

its just doing somthing

scarlet bear
#

send your localscript code

fresh harbor
#
local Convert = game.ReplicatedStorage.Convert

script.Parent.MouseButton1Click:Connect(function()
    print("Convert sent")
    ReplicatedStorage:WaitForChild("Convert"):FireServer()
end)```
shell oxide
#

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

fresh harbor
#

...

shell oxide
#

u need to send the calucation value through fireserver

#

example

#

local val = 1

event:FireServer(val)

shrewd pathBOT
#

studio** You are now Level 2! **studio

shell oxide
#

then u can do

fresh harbor
#

uhm how?

shell oxide
#

event.OnServerEvent:Connect(function(value)
print("value from client is: "..val)
end)

halcyon oak
#

@fresh harbor is point an integer value or a number value?

shell oxide
#

if you dont know how to send data between clients i would recommend looking up a tutorial on how remote events work

hollow hamlet
#

do another clip and show the output

shell oxide
#

client to server*

fresh harbor
#

...

hollow hamlet
#

just do a clip and show output

shell oxide
#

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

fresh harbor
#

...

hollow hamlet
#

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

fresh harbor
#

...

hollow hamlet
#

u have to show the explorer

#

show everything

fresh harbor
glad ermine
hollow hamlet
fresh harbor
glad ermine
hollow hamlet
#

put script in starter gui

fresh harbor
#

its not in gui

hollow hamlet
#

put the local script

fresh harbor
#

screengui*

hollow hamlet
#

into starter gui

#

I know

glad ermine
fresh harbor
hollow hamlet
#

ok test

glad ermine
#

Yeah but there is a problem

hollow hamlet
#

but change script.Parent.MouseButton1Click

glad ermine
#

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

fresh harbor
glad ermine
hollow hamlet
#
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

glad ermine
fresh harbor
#

huh?

glad ermine
#

The pd value needs to be sent to the server

#

You did only for points

fresh harbor
#

why do I need to?

#

in the local?

glad ermine
#

Yeah, i mean you want to use pd value right?

fresh harbor
#

yes?

glad ermine
# fresh harbor

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)

fresh harbor
glad ermine
fresh harbor
glad ermine
# fresh harbor

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?

fresh harbor
#

wow

#

its working

fresh harbor