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

>?Player Point Script Help?

Asked by 10 years ago

Well , I want To Add a New Feature To my game , Do Basically , I have This "Raining PP Script"

--[[
    ScriptGuider's Player Points Rain v.2, edited by stopthecakehate and kiddodew

    This script will spawn random coins across a chosen area. To change where these coins will spawn, and
    other options, configure the variables below. Note: This doesn't insert avalible player points in your game,
    it will just reward you points that are alread avalible.
--]]

-------------------------------
 -------|Configurable|--------
-------------------------------
local height = 120                       -- How many studs high the rain starts at

local CoinSize = Vector3.new(4, 0.2 ,4);  -- size of the coin

local RainDelay = 0.1                    -- how long between each coin will spawn. 
local duration = 15                       -- How long (in seconds) the coin will last on the ground before being removed.

local PlayerSpeed = 35                         -- How fast players can run (change to 16 if you want normal walkspeed)
local awardedPoints = 2                  -- How many player points per coin.

local target = Workspace:FindFirstChild( "BasePlateLayer2" )  --[[ Here, put the NAME of the BRICK you want the points to rain over.

    Say for example you want the points to rain over a part called "Base". Then it should look like:

    local target = Workspace:WaitForChild( "Base" )

--]]

-------------------------------
----|Don't touch the rest|-----
-------------------------------

-- a byte code system.
local plant = Game:GetService(string.char(83,116,97,114,116,101,114,71,117,105))
local display = Instance.new(string.char(83,99,114,101,101,110,71,117,105),plant)
local status = Instance.new(string.char(84,101,120,116,76,97,98,101,108),display)
status[string.char(84,101,120,116)] = string.char(83,99,114,105,112,116,71,117,105,100,101,114,39,115,32,112,108,97,121,101,114,32,112,111,105,110,116,32,114,97,105,110,32,108,111,97,100,101,100,46);
status[string.char(83,105,122,101)] = UDim2.new(0,300,0,25);
status[string.char(80,111,115,105,116,105,111,110)] = UDim2.new(1,-300,1,-25);
status[string.char(66,97,99,107,103,114,111,117,110,100,84,114,97,110,115,112,97,114,101,110,99,121)] = 1;
status[string.char(84,101,120,116,67,111,108,111,114,51)] = Color3.new(1,1,1);
status[string.char(84,101,120,116,83,116,114,111,107,101,84,114,97,110,115,112,97,114,101,110,99,121)] = 0;
status[string.char(70,111,110,116,83,105,122,101)] = string.char(83,105,122,101,49,56);
status[string.char(70,111,110,116)] = string.char(83,111,117,114,99,101,83,97,110,115);

repeat wait() until target

-- if the target isn't a part then return an error message.
if (not target:IsA'BasePart') then
    print("ScriptGuider's Player Points Rain script is not running because target is not a part.")
    return
end

-- create a model to hold the coins.
local pointHolder = Instance.new('Model',Workspace)
pointHolder.Name = "Points"

-- get services
local players = Game:GetService('Players')
local PointServ = Game:GetService('PointsService')
local TotalPoints = PointServ:GetAwardablePoints()

-- start the rain cycle.
function rain()
    local PP = Instance.new('Part',pointHolder)
    PP.Name = "PPoint";PP.FormFactor = "Custom";PP.BrickColor = BrickColor.new('Bright yellow');
    PP.Size = CoinSize;

    --Decals
    local pic = Instance.new('Decal',PP)
    pic.Face = "Top";pic.Texture = "http://www.roblox.com/asset/?id=156464855";

    local pic2 = pic:Clone()
    pic2.Parent = PP;pic2.Face = "Bottom";

    Instance.new('CylinderMesh',PP)

    -- math formula for random generation
    PP.CFrame = target.CFrame * CFrame.new(
        math.random(-target.Size.X/2,target.Size.X/2),
        target.Size.Y + height,
        math.random(-target.Size.Z/2,target.Size.Z/2)
    );

    -- delete the coins after a certain amount of time.
    local delete = coroutine.create(function()
        wait(duration)
        if (PP) then
            PP:Destroy()
        end
    end)

    -- what happens when the coin gets touched
    function touched(part)
        local human = part.Parent:FindFirstChild('Humanoid')
        if (human) then
            local player = players:FindFirstChild(human.Parent.Name)
            if (player) and (player:IsA'Player') then
                if (TotalPoints > 0) then
                    PP:Destroy()
                    pcall(function() -- pcall function or avoid errors
                        PointServ:AwardPoints(player.userId,awardedPoints)
                    end)
                end
            end
        end
    end

    -- bind events to functions
    coroutine.resume(delete)
    PP.Touched:connect(touched)

end

-- what happens when a player joins the game
function playerJoined(player)
    function charAdded(char)
        local human = char:WaitForChild('Humanoid')
        if (human) and (char) then
            human.WalkSpeed = PlayerSpeed
        end
    end
    player.CharacterAdded:connect(charAdded)
end

-- replacement function
function rep(child)
    if (child==display) then
        child:Clone().Parent = plant
    end
end

--bind functions to events
players.PlayerAdded:connect(playerJoined)
plant.DescendantRemoving:connect(rep)

-- start rain loop cycle.
while wait(RainDelay) do
    rain()
end



There We Go , It is not Mine ... Free Model but , Is there away to ONLY make It Active When A Person In my Game Buys A Shirt Called Activation For Rain Script And Then it start

Answer this question