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

Body Force value Changing but not doing anything?

Asked by 2 years ago

So I am making a cart ride game with a sabotage button and I have a big problem. So when you type in your own name it works and sabotages you. But someone elses name well the values change of the body force and everything goes through its just its not doing anything. Here is the script but I am so stuck on this

module script

local MPS = game:GetService("MarketplaceService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local waitForCharacter = true
local Name = ReplicatedStorage:WaitForChild("CurrentName")
local event = game.ReplicatedStorage.RemoteEvent
local Carts = game.Workspace["Cart Track"]["Click To Regen Cart"].Carts
local magnitude = 200
local left = Vector3.new(20000000000000, 1000000000000, 400000000) * magnitude
print("HELLO")

function Bruh.flung(v,i)
    print("Start of loop")
    print(i)
    print(Carts:GetChildren())
    print(v.Seat.Occupant)
    print(v.Safe.Occupant)
    if not v.Seat.Occupant and not v.Safe.Occupant then return end
    --do nothing
    print("After return end should work")
    if not v.Seat.Occupant then 
        local hum = v.Safe.Occupant
        print(1.5)
        if not hum then return end
        --do nothing

        print(2)
        local plr = game.Players:GetPlayerFromCharacter(hum.Parent)
        print(2.5)
        if not plr then return end 
        --do nothing
        print(plr.Name)
        print(Name.Value)
        print(Name)
        print(plr.Name == Name.Value)


        if plr.Name == Name.Value == true then
            local force = v.Engine.BodyGyro
            force.MaxTorque = Vector3.new(1000, 1000, 400)
            force.P = -900000
            force.D = -500
            wait(1.5)
            force.D = 500
            force.P = 3000
            force.MaxTorque = Vector3.new(0, 0, 400000000)
        else
            return
        end
    end  


    if not v.Safe.Occupant then
        local hum = v.Seat.Occupant
        print(1.5)
        if not hum then return end
        print(2)
        local plr = game.Players:GetPlayerFromCharacter(hum.Parent)
        print(2.5)
        if not plr then return end  
        print(plr.Name)
        print(Name.Value)
        print(Name)


        if plr.Name == Name.Value == true then
            local force = v.Engine.BodyGyro
            force.MaxTorque = Vector3.new(1000, 1000, 400)
            force.P = -900000
            force.D = -500
            wait(1.5)
            force.D = 500
            force.P = 3000
            force.MaxTorque = Vector3.new(0, 0, 400000000)
        else
            return
        end
    end

    if v.Seat.Occupant and v.Safe.Occupant  then
        print(1)
        local hum = v.Seat.Occupant
        local hum2 = v.Safe.Occupant
        print(1.5)
        if not hum or hum2 then return end
        print(2)
        local plr = game.Players:GetPlayerFromCharacter(hum.Parent)
        local plr2 = game.Players:GetPlayerFromCharacter(hum2.Parent)
        print(2.5)
        if not plr or plr2 then return end  
        print(plr.Name)
        print(plr2.Name)
        print(Name.Value)
        print(Name)

        if plr.Name == Name.Value == true then
            local force = v.Engine.BodyGyro
            force.MaxTorque = Vector3.new(1000, 1000, 400)
            force.P = -900000
            force.D = -500
            wait(1.5)
            force.D = 500
            force.P = 3000
            force.MaxTorque = Vector3.new(0, 0, 400000000)

        elseif plr2.Name == Name.Value == true then
            local force = v.Engine.BodyGyro
            force.MaxTorque = Vector3.new(1000, 1000, 400)
            force.P = -900000
            force.D = -500
            wait(1.5)
            force.D = 500
            force.P = 3000
            force.MaxTorque = Vector3.new(0, 0, 400000000)
        else
        return
        end
    end
    end



return Bruh

0
make sure its a server script that calls the module TehEpixNeon 0 — 2y

Answer this question