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

how do i make to script activate if hit with high speed?

Asked by 3 years ago

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!

0
Maybe just add an if statement that checks player speed and if the speed is above your set speed, break the wall? Lightning_Game27 232 — 3y
0
i know hat if statment means but how do the speed checker would look so i can write it myself (lines after if) Natano2018 -5 — 3y
0
Well, after you check if the touched object is a player, you just add ```if hit.Parent.Humanoid.Speed > minSpeed then``` to check the player's speed. thecelestialcube 123 — 3y

2 answers

Log in to vote
0
Answered by 3 years ago

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?

0
(im asking for what ray is) Natano2018 -5 — 3y
0
its not working Natano2018 -5 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

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)

Answer this question