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

How could I fix this Magnitude script? Works in studio but not in game! [function]

Asked by 7 years ago

So yeah, this script works in studio but it doesnt work in game.. Help pls?!

local button = script.Parent
local votes = script.Parent.votes
local touches = {}

while true do
    wait()
    for i,v in pairs(game.Players:GetChildren()) do
        if v.Character:FindFirstChild("LowerTorso") ~= nil and (v.Character.LowerTorso.Position - button.Position).magnitude <=5 and v.Character.LowerTorso:FindFirstChild("antispam") == nil then

            local value = Instance.new("BoolValue") 
            value.Parent = v.Character.LowerTorso
            value.Name = "antispam" 
            print("in")
            votes.Value = votes.Value + 1       

        elseif v.Character:FindFirstChild("LowerTorso") ~= nil and (v.Character.LowerTorso.Position - button.Position).magnitude > 5 and v.Character.LowerTorso:FindFirstChild("antispam") ~= nil then
            v.Character.LowerTorso.antispam:Destroy()   
            votes.Value = votes.Value - 1
        end
    end
end

Thx :P

0
error? OldPalHappy 1477 — 7y
0
nop starchip12 6 — 7y
0
There doesn't seem to be any issues with this code, it may be an error in another script Querq 20 — 7y
0
Well I pasted the script in a empty place and it still doesnt work in game, rest im macarnois starchip12 6 — 7y

Answer this question