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)

2 comments
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.
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.