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

[SOLVED] ca anyone help me with how to pass a value object through a remote event?

I tried many times many way's but it isn't working? Could somone help?

It's all in a GUI but i did this quick it's not complete

Localscript:

local targetname = target.Parent.Name

script.Parent.Target:FireServer(targetname)

ServerScipt

script.Parent.Target.OnServerEvent:Connect(function(player, targetname)
	script.Parent.Username.Value = targetname
end)

14 comments

0

you need to put player in the arguments of the serverscript, OnServerEvent

0

and the other parameter should be after the player too

0

Nope

0

What is the parent of your script, local script, and event? I bet the error is either the scripts being parented incorrectly or that the Value is not a StringValue

0

If u see they are good parented?

0

The parent is a frame

0

The parent of the script and event is a frame?

0

Yea

0

Move the event to replicated storage and move the script to serverscriptservice

0

Okey

0

Not working to

0

What went wrong? You will obviously need to adjust your variables if you haven't done so already

0

Server scripts don't run in PlayerGui in a server. They will with Play Solo though. As mentioned by Vulkarin, move the objects, and make sure the "Username" object is accessible by both script types, preferably in Workspace or ReplicatedStorage

0

Bu i need a value for every player that’s a cop so that will not work when 2 players need to bebarrested

1 answer

The problem is that you never defined the term target at the beginning of your script, meaning that roblox won't know what target is and return an error. Simply, just define a variable called target at the beginning of your local script and that should do the trick.

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