#Hey can sombody help me with somthing im very new to scripting
23 messages · Page 1 of 1 (latest)
everytime you use your sword
but i want it so when it hits 300
you will unlock a diff sword
i have the system
working
i just dont know how to make this thing work
here is the code btw
wait(1)
local player = game.Players.LocalPlayer
local Power = player.leaderstats.Power
script.Parent.ProgressFrame.Bar:TweenSize(UDim2.new(0, (Power.Value/300 * 476), 1, 0), 'Out', 'Linear', '1')
player.leaderstats.Power:GetPropertyChangedSignal("Value"):Connect(function()
local PowerValue = player.leaderstats.Power.Value
if PowerValue >= 300 then
PowerValue = 300
end
script.Parent.ProgressFrame.Bar:TweenSize(UDim2.new(0, (PowerValue/300 * 476), 1, 0), 'Out', 'Linear', '1')
script.Parent.ProgressFrame.TextLabel.Text = PowerValue.."/300"
end)
Easiest way to achieve this is to have a table full of swords, then if Value = (one of the values) then
oldsword:Destroy()
Then copy the new sword into the backpack
kk thanks
but i also want
it to like change the text
to like 600
after you get a new sword
Just run 2 scripts at the same time
One in the ui
One for the server sided handling
kk
hey @tribal rampart
would this work?
game.ReplicatedStorage.Unlockment1.OnServerEvent:Connect(function(player)
while true do
wait()
if player.leaderstats.Power.Value >= 300 then
player.Backpack:ClearAllChildren()
if player.Character:FindFirstChildWhichIsA("Tool") then
player.Character:FindFirstChildWhichIsA("Tool"):Destroy()
end
local sword = game.ServerStorage.Swords.Sword2:Clone()
sword.Parent = player.Backpack
end
end
end)
wait it works