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

Why doesn't this script work in my football?

Asked by 6 years ago
Edited 6 years ago

Ok so I have Filtering Enabled and I would like to keep it on and I have a tool named "Football"

Inside the Football tool, is a LocalScript and inside that LocalScript is a Script.

And inside the Script, i want it to subtract 1.75 from the velocity of the Tool's handle until it hits an object.

When i run it in studio it works perfectly, but actually in-game it doesn't work at all it just floats away.

Here Is The Script

local replicatedstorage = game:GetService("ReplicatedStorage")
local players = game:GetService("Players")
local bodyp = script.Parent.BodyVelocity
local bodya = script.Parent.BodyAngularVelocity
local connection = nil
local power=tonumber(script.Name) or 0;

function OnTouch(hit)
    if (hit.CanCollide and hit.Anchored) then
        bodya:Remove()
        bodyp:Remove()
        connection:disconnect()
    end
end


connection = script.Parent.Touched:connect(OnTouch)

while true do
wait()
bodyp.velocity=bodyp.velocity-Vector3.new(0,1.75,0);
end

The Script and LocalScript does not use any RemoteEvents but everything else works perfectly its just this part while true do wait() bodyp.velocity=bodyp.velocity-Vector3.new(0,1.75,0); end

0
This code is in the script or the localscript? cabbler 1942 — 6y
0
Its in the script, and hey cabbler lol InnovativeDesires 0 — 6y
0
lol i didn't recognize you. yo. If this all in the script Idk what to tell you. Debug that loop by printing stuff every time cabbler 1942 — 6y
0
Ok InnovativeDesires 0 — 6y
View all comments (3 more)
0
Want to talk on discord? InnovativeDesires 0 — 6y
0
And nothing gets printed when the ball is thrown InnovativeDesires 0 — 6y
0
@InnovativeDesires I really don't know. Best I can offer right now, add a print() in between every line, and see where the script stops executing. Random guess, add wait() right at the beginning, it USED to help things execute properly... protectiveebob 221 — 6y

Answer this question