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

Speed Badge possible?

Asked by 10 years ago

Hey guys,

First of all, I know that this is not an ask and give service, but I would like help on this script.

Basically, if a player reaches a certain speed when they touch a brick, they are awarded a gamepass.

Also, I would like the speed when they touch to be updated on the leaderboard.

This is how I think it would look like:

local plr = game.Players.LocalPlayer

script.Parent.Touched:connect(function(Touched)
    if game.Players:FindFirstChild(Touched.Parent.Name) ~= nil then
        local speed= stats:findFirstChild("Speed Score")
        speed.Value  = plr.Character.Torso.Velocity.magnitude / 1.45

function OnTouch(part)
    if speed.Value < 252
    local b = game:GetService("BadgeService")
    b:AwardBadge(p.userId, script.Parent.BadgeID.Value)
end


script.Parent.Touched:connect(OnTouch)

I have no idea whats going on with this script ATM, so I am hoping that someone here can give me a hand.

Thanks,

  • Michael
0
I'll assume you mean badges, not game passes? Perci1 4988 — 10y
0
Whoops, yep! Michael007800 144 — 10y

1 answer

Log in to vote
0
Answered by
Relatch 550 Moderation Voter
10 years ago

Well, you forgot 2 ends in your script. I'm not that good at badge awarding, but I do know that. I'll show you where they are supposed to be.

local plr = game.Players.LocalPlayer

script.Parent.Touched:connect(function(Touched)
    if game.Players:FindFirstChild(Touched.Parent.Name) ~= nil then
        local speed= stats:findFirstChild("Speed Score")
        speed.Value  = plr.Character.Torso.Velocity.magnitude / 1.45
    end 
end)

function OnTouch(part)
    if speed.Value < 252
    local b = game:GetService("BadgeService")
    b:AwardBadge(p.userId, script.Parent.BadgeID.Value)
end


script.Parent.Touched:connect(OnTouch)

0
That script was merely an example, it (probably) doesn't work. I'll try it out and if it does, then I'm better at Lua than I thought. Michael007800 144 — 10y
0
Nah, it doesn't work. Michael007800 144 — 10y
Ad

Answer this question