How to change values on specific players?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve?
    When you type a player’s name in a textbox and then click the confirm button, it will change the player’s level value.

  2. What is the issue?

  3. What solutions have you tried so far?
    For what I have researched, I need to make my script/code more specific to find the thing that I want to address in my script. Sadly, it did not work.

local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local PlayerName 
local Individual

local event1 = script.Parent.Parent.ebents.EditLplayer

event1.OnServerEvent:Connect(function(player)
	PlayerName = script.Parent.Parent.Players.SearchBox.Text
	Individual = Players:FindFirstChild(PlayerName)
	Individual.DataFolder:WaitForChild("Level").Value = script.Parent.Parent.Players.Level.Text
end)
3 Likes

Where did you create a DataFolder? It seems that it doesn’t exist with that error at the line 11?

image

First of all try creating a variable:

local DataFolder = Player:WaitForChild("DataFolder")

If this is in a serverscript, then can’t you just get the DataFolder variable from the player instance being passed in?

like

event1.OnServerEvent:Connect(function(player)
	local DataFolder = player:FindFirstChild("DataFolder)
end)

It’s in StarterGui.
image

So since this is a serverscript then you can try the method i posted in getting your DataFolder variable

quick sidenote:
i normally dont try putting serverscripts inside any screengui

You cannot use OnServerEvent in a local script, you must use it in a server script.

how does it work? where i put my value like (health=700)?