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" :(
The issue you are most likely facing, is that the player is already loaded, so it will not trigger the PlayerAdded
event.
It will only fire locally for them for all players who join after they do.
--
To solve this, remove the whole function and just run the contents at the top of the LocalScript, because the LocalScript runs when the player joins.
Entire script:
script.Parent.Text = "jaja"
However, if you are doing this, you might as well just configure the Text to be this in the StarterGui without a script at all, in order to set the default/initial text.
Please update your question with additional information if this did not solve your problem.
EDIT:
If you just want giveLevel and currentexpCalculate to run whenever the player initially joins, keep it in a LocalScript, and just call both of them after you've defined everything else.
--your entire new script you posted --the bottom of it giveLevel() currentexpCalculate()