Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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.

2 comments

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?

0

You can pass multiple arguments when firing a RemoteEvent.

This discussion is preserved as it was. New answers, comments, and votes are closed.