Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

i have problem in getting the value someone help me please?

Asked by 5 years ago

Script

local theeventis = script.Parent.Main
local thevalueis = script.Parent.TheValueOfIt.Value

local function servergotfired(player, pname)
    game.Players[pname].leaderstats.Cash.Value = thevalueis
end

theeventis.OnServerEvent:Connect(servergotfired)

LocalScript

script.Parent.pressme.MouseButton1Down:Connect(function()
    local pname = script.Parent.pname
    local pvalue = script.Parent.pvalue
    local theeventis1 = script.Parent.Parent.Main
    local Player = game.Players

    script.Parent.Parent.TheValueOfIt.Value = pvalue.Text
    theeventis1:FireServer(pname.Text)
end)

So basically my problem here is to get the value that I want to put in the following name using script not local script, The real problem is the script can't get the value of TheValueOfIt. Someone Help Me Please!

1 answer

Log in to vote
0
Answered by 5 years ago

You're trying to set the value of an object on the client and then retrieve that value on the server. This doesn't work because it's FilteringEnabled and the changes you made via the LocalScript don't replicate to the server. What you want to do instead is to pass TheValueOfIt through the RemoteEvent, along with pname.Text, and then you can get it in your Script, along with pname.

0
it doesn't work because if i add the TheValueOFIt and the pname its double so i don't know how to do it.. please help? ImAnonymousBan 24 — 5y
0
You can pass multiple arguments when firing a RemoteEvent. cowsoncows 951 — 5y
Ad

Answer this question