Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I am trying to make a stat multi that gives me more of a currency can anyone help?

Asked by
WN0820 11
4 years ago

I am trying make a script when I have 2 multi I gain +1 and when I have 3 multi then I will get another +1 I don't know where I went wrong in this script

local plr = script.Players.LocalPlayer
local tool = script.Parent
local anim = tool:WaitForChild("Using")
local player = tool.Parent:IsA("Model") and game.Players:GetPlayerFromCharacter(tool.Parent) or tool.Parent.Parent
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local humR = char:WaitForChild("HumanoidRootPart")
local deb = false
09   
tool.Activated:Connect(function()
      local stats = player:FindFirstChild("Stats")
        if stats then
            local Multi = stats:FindFirstChild("Multi")
            local meditate = stats:FindFirstChild("PunchPower")
            if meditate and deb == false then
                deb = true
                local animPlay = hum:LoadAnimation(anim)
                animPlay:Play()
                local selected
                for i,v in pairs(workspace:WaitForChild("Zones"):GetChildren())do
                    if v:FindFirstChild("Requires") and v:FindFirstChild("Value") and v:FindFirstChild("Stats") and v.Stats.Value == "PunchPower" then
                        if (humR.Position-v.Position).Magnitude <= v.Magnitude.Value and meditate.Value >= v.Requires.Value then
                            selected = v
                        end
                    end
                end
                if selected == nil then
                    if Multi.Value >= 2 then
                        meditate.Value = Multi.Value +1
                    else
                       meditate.Value = 1

                        meditate.Value = meditate.Value + 1
                    meditate.Value = meditate.Value + selected.Value.Value
                end
                wait(1)
                deb = false
                    end
            end
        end
    end)


If you can help thanks, and don't be one of those people that says LEARN SCRIPTING I am trying to okay

Answer this question