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

Playerpoint not recived if player faster than declared speed. Something undeclaired?

Asked by 9 years ago

I have this script here that should give the player a Player Point if they go faster than 252 Studs per Second. I think I may have something undeclared but I can't see it myself. Maybe one of you guys can!

  • Michael
function OnTouch(part)
    local speed = part.Velocity.magnitude
    local character = part.Parent
    if not character then
        return -- A bullet that doesnt have a parent
    end
    local player = game.Players:GetPlayerFromCharacter(character)
    if player then
        -- It is a player that is touching this
        if speed > 252 then
        local pps = game:GetService("PointsService")
            if pps:GetAwardablePoints() >= 1 then
            pps:AwardPoints(player.userId, 1)
        end
    end
end
script.Parent.Touched:connect(OnTouch)

0
You cannot set the actual magnitude as a variable. If you do this, it will be an unchanging variable. Try moving line 3 to line 11. ChipioIndustries 454 — 9y
0
That would then ruin line 9 that needs the local speed. I have changed the script slightly and trying somthing else that might be easyer. Michael007800 144 — 9y

Answer this question