I have made a level system (not leaderstat) but with a UI.
local player = game.Players.LocalPlayer
local xp = player:WaitForChild(“Exp”)
local level = player:WaitForChild(“levels”)
local maxExp = 100xp.Changed:Connect(function()
if xp.Value >= maxExp then
script.Parent.Size = UDim2.new(xp.Value/maxExp,0,1,0)
wait(0.5)
xp.Value = xp.Value - maxExp
script.Parent.Size = UDim2.new(xp.Value/maxExp,0,1,0)
level.Value = level.Value + 1
else
script.Parent.Size = UDim2.new(xp.Value/maxExp,0,1,0)
end
end)script.Parent.Size = UDim2.new(xp.Value/maxExp,0,1,0)
this is the script I made for the level UI
Currently I am trying to make a block that if u touch it it will give you XP
The current script I have is
local player = game.Players.LocalPlayer
local xp = player:WaitForChild(“Exp”)
local level = player:WaitForChild(“levels”)
local part = game.Workspace.FinishBricks.GrassThemeFinish
local function onPartTouched(otherPart)
– Get the other part’s parent
local partParent = otherPart.Parent
– Look for a humanoid in the parent
local humanoid = partParent:FindFirstChildWhichIsA(“Humanoid”)
if humanoid then
xp.Value = xp.Value + 15
end
end
This script is a local script I put in StarterGui.
I do not see why this is not working…
Can someone tell me why this is not working and how to fix it…