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

How do i make a script that converts one team's leaderstats into another team leaderstat?

Asked by 2 years ago

Hi, this is my script i have right now

local Players = game:GetService("Players")
local TouchPart = workspace.Part 
local RESET_SECONDS = 1.3
local isTouched = false
local player = game:GetService("Players")
local teams = game:GetService("Teams")


TouchPart.Touched:Connect(function(touched)
    if touched.Parent:IsA("Model") and touched.Parent:FindFirstChild("Humanoid") then
        local Player = Players:GetPlayerFromCharacter(touched.Parent)
        if Player then
            if not isTouched then
                isTouched = true
                if Player.leaderstats.Cotton.Value <= 0 then
                    print("You dont have any cotton")
                    wait(RESET_SECONDS)
                    isTouched = false
                else 
                    local leaderstats = Player.leaderstats -- from here
                    local Notes = leaderstats and leaderstats:FindFirstChild("Cotton")
                    if Notes then

                        teams.Owner.PlayerAdded.Notes.Value = teams.Owner.PlayerAdded.leaderstats.Notes.Value + Notes.Value
                        Notes.Value = Notes.Value - Notes.Value -- to here



                    end
                end
            end
        end
    end
    end)

and all i am getting in output is "Notes is not a valid member of RBXScriptSignal"

0
which line is it saying "Notes is not a valid member or RBXScriptSignal"? unitotosty67756 -2 — 2y
0
local Notes = leaderstats and <Object> ?? unitotosty67756 -2 — 2y

Answer this question