local Players = game:GetService("Players")
function starter()
wait(1)
script.Parent.Text = "jaja"
end
game.Players.PlayerAdded:connect(starter)
both in-game, in studio and in local server
FULL CODE
--FULL CODE INSIDE GUI, PUT IT IN A SERVER SIDE SCRIPT BUT PLAYER ADDED FOR CURRENTEXP CALCULATE AND GIVELEVEL STILL DOESNT WORK--
local owner = game.Players.LocalPlayer
local ownerStats = owner.Stats
local currentExp = 100
local var = 1
local expNeeded
function onLevel()
ownerStats.Value = ownerStats.Value+3
ownerStats.Defense.Value = ownerStats.Defense.Value+1
ownerStats.Strength.Value = ownerStats.Strength.Value+1
ownerStats.Vitality.Value = ownerStats.Vitality.Value+1
ownerStats.Agility.Value = ownerStats.Agility.Value+1
ownerStats.Dexterity.Value = ownerStats.Dexterity.Value+1
ownerStats.Intelligence.Value = ownerStats.Intelligence.Value+1
end
function currentexpCalculate()
while var <= ownerStats.Lvl.Value do
currentExp = currentExp*(1+(.20))
var = var+1
end
expNeeded = currentExp
if ownerStats.Exp.Value <= expNeeded then
owner.PlayerGui.mainUI.Frame.expHolder.expBar:TweenSize(UDim2.new(ownerStats.Exp.Value/expNeeded, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle. Linear, 0.1)
end
end
function expChanged()
currentexpCalculate()
if ownerStats.Exp.Value >= expNeeded then
while ownerStats.Exp.Value >= expNeeded do
ownerStats.Exp.Value = ownerStats.Exp.Value-expNeeded
ownerStats.Lvl.Value = ownerStats.Lvl.Value+1
onLevel()
end
end
end
function runThis()
owner.PlayerGui.mainUI.Frame.expHolder.expBar:TweenSize(UDim2.new(ownerStats.Exp.Value/expNeeded, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle. Linear, 0.1)
owner.PlayerGui.mainUI.Frame.pictureHolder.levelHolder.Text = ownerStats.Lvl.Value
end
function giveLevel()
print("lmao")
script.Parent.Parent.mainUI.Frame.pictureHolder.levelHolder.Text = owner.Character.Name
end
game.Players.PlayerAdded:Connect(giveLevel)
game.Players.PlayerAdded:Connect(currentexpCalculate)
ownerStats.Exp.Changed:Connect(expChanged)
ownerStats.Lvl.Changed:Connect(runThis)
IT DOESNT EVEN PRINT "LMAO" :(

22 comments
the script is inside the textlabel btw
PlayerAdded is server side only.
PlayerAdded is only for in-game?
You shouldn’t be using it in a LocalScript^
how do you access local players from a server side script? the same when using a localscript?
No. You can access the player using PlayerAdded, OnServerEvent, MouseClick, etc.
so what do you want to do, change the text each time a player joins or each time a player spawns?
when a player joins. however that piece of info that playeradded can only be used in serverside helps my game a lot since i mostly rely on localscripts lmao. so how do i find the player in workspace players in a serverside script?
Clarify what you are trying to do and I will post a response. Are you trying to change it to something different each time a new player spawns, or are you just trying to set the text initially, and that is a constant value like in your script? Edit your question to clarify.
game.Players.PlayerAdded:Connect(function(player) print(player.Name) end)
i want to change it once just when a player joins since its supposed to be a level display script for an rpg game (i want the loaded level to display on spawn)
So you want all players to see "jaja"?
i want the certain player to see "jaja" on his gui
who is the certain player?
you want all players to see "jaja" whenever they initially join?
Accidently added the answer :P
yes wait i will update with full code
You’re using LocalPlayer from the server.
it works with the other parts of the script, just not on playeradded, how would i find the individual player's gui without localplayer? :o
i updated my answer
i tried script.Parent.Parent.Parent everything works besides the playeradded functions
read the edit in my answer