Hi, I am making a UI which has an unlockable functionality.
The functionality itself works fine, but I am having trouble properly notifying the user that they do not have enough points to use the UI.
Here is my script:
local player = game.Players.LocalPlayer
local points = player:WaitForChild("leaderstats").Points
if player:WaitForChild("leaderstats").Points.Value >= 25 then
script.Parent.MouseButton1Click:Connect(function()
player.Character:MoveTo(Vector3.new(-7, -29, -6))
script.Parent.Text = "Teleported!"
wait(1.5)
script.Parent.Text = "Teleport"
end)
else
script.Parent.Text = "Locked!"
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Text = "π"
wait(1.5)
script.Parent.Text = "Locked!"
end)
end
points:GetPropertyChangedSignal("Value"):Connect(function()
if player:WaitForChild("leaderstats").Points.Value >= 25 then
script.Parent.Text = "Teleport"
script.Parent.MouseButton1Click:Connect(function()
player.Character:MoveTo(Vector3.new(-7, -29, -6))
script.Parent.Text = "Teleported!"
wait(1.5)
script.Parent.Text = "Teleport"
end)
else
script.Parent.Text = "Locked!"
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Text = "π"
wait(1.5)
script.Parent.Text = "Locked!"
end)
end
end)
I donβt really know how to describe the problem I am having, so Iβll just put a video to show what I am having trouble with:
Yes, I am aware that the UI is horribly misaligned, Iβll fix it later.