#i have 2 scripts that should do the same thing but they act differently for some reason. why?

1 messages · Page 1 of 1 (latest)

wooden sapphire
#

this one is the one that works good with no bugs.

local myplayer = game:GetService("Players").LocalPlayer
local mycharacter = myplayer.Character or myplayer.CharacterAdded:Wait()
local myhumanoid = mycharacter:FindFirstChild("Humanoid")
local myhrp = mycharacter:FindFirstChild("HumanoidRootPart")

local Katana = script.Parent

local MEvent = Katana.MEvent

local UIP = game:GetService("UserInputService")

local slowfall = false
UIP.InputBegan:Connect(function(input, gameProcessedEvent)
    if gameProcessedEvent then return end
    if input.KeyCode == Enum.KeyCode.M then
        --MEvent:FireServer()
        if slowfall == false and myhumanoid:GetState() == Enum.HumanoidStateType.Freefall then
            slowfall = true
            while wait() do
                myhrp.AssemblyLinearVelocity += Vector3.new(
                    0,
                    4,
                    0
                )
            end
        end
    end
end)
local myplayer = game:GetService("Players").LocalPlayer
local mycharacter = myplayer.Character or myplayer.CharacterAdded:Wait()
local myhumanoid = mycharacter:FindFirstChild("Humanoid")
local myhrp = mycharacter:FindFirstChild("HumanoidRootPart")

local upgrade3RemoteEvent = game:GetService("ReplicatedStorage"):FindFirstChild("upgrade 3 RemoteEvent")

local slowfall = false
local upgrade3 = false
upgrade3RemoteEvent.OnClientEvent:Connect(function()
    upgrade3 = true
    if slowfall == false and myhumanoid:GetState() == Enum.HumanoidStateType.Freefall then
        slowfall = true
        while wait() do
            myhrp.AssemblyLinearVelocity += Vector3.new(
                0,
                4,
                0
            )
        end
    end
end)

while this bottom one here bugs out a lot and it works weirdly. it looks a bit like lag.

#

the event fires once btw

#

for both of them

leaden pelican
wooden sapphire
#

they do the same thing differently

#

one foe sthe same thing as it should by pressing e

#

the other one is by an event

leaden pelican
#

ok then make a modulescript

#

slap the function in there

#

and then require it

#

ngl I didnt even read the code

#

I was too lazy

#

idk what ur doing bro

tough goblet
#

i think its the katana

#

why did you say its not the katana

#

or its some other outside factor