hello i need help! i want to make breakable level crossing barrier. but i dont want to it break on litte touch! So is there any way to make barrier break on high speed? i mean idk break weld? (i know how to do that) but i dont know how to make script activate when Parent is hit wilt speed for example 50 sps if you have answer to this q then thanks!
COMMUNITY QUESTION
how do i make to script activate if hit with high speed?
2 answers
i found a post in roblox dev forum and it looks like this ( a speed camera script)
Polyheximal Programmer Mar '20
Theoretically, you could use raycasts from a speed camera to see if there are any players nearby. If there are, then check the speed of that player.
Pseudo-ish:
ray.New()
if rayCanSeeAnyPlayers then
if playerSpeed > speedLimit then
print("is speeding")
end
end
can anyone say what "ray" is?
2 comments
0
(im asking for what ray is)
0
its not working
Maybe something like this will work:
local barrier = game.Workspace.Barrier --Just reference the barrier here
barrier.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if hit.Parent.Humanoid.Speed >= [insert minimum speed here] then
barrier:Destroy()
end
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Maybe just add an if statement that checks player speed and if the speed is above your set speed, break the wall?
i know hat if statment means but how do the speed checker would look so i can write it myself (lines after if)
Well, after you check if the touched object is a player, you just add
if hit.Parent.Humanoid.Speed > minSpeed thento check the player's speed.