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

The reaction time for my fire skill has a slow reaction time, why is this?

Asked by 6 years ago

Code:

wait(4)
script.Parent.Ferid.OnServerEvent:Connect(function(Player, Mouse)
    local maxrange = 100
    script.Parent.Parent.Parent.Data.Tries.Value = script.Parent.Parent.Parent.Data.Tries.Value + 50
    local AlreadyTouched = false
    local Character = Player.Character or Player.CharacterAdded:wait()
    local torso = Character.UpperTorso
    local Shower = game.ReplicatedStorage.FireShower:Clone()
    Shower.Parent = game.Workspace
    for i,v in pairs(Shower:GetDescendants()) do
        if v:IsA("Part") then
            local ray = Ray.new(Character.HumanoidRootPart.CFrame.p, (Mouse.p - Character.HumanoidRootPart.CFrame.p).Unit * 100)
            local endPos = ray.Origin + ray.Direction
            local distance = (Mouse.Position-torso.Position).Magnitude
            if distance < maxrange then
                v.CFrame = v.CFrame + Mouse*Vector3.new(Mouse.Position,Mouse.Position,Mouse.Position)
            else
                v.CFrame = v.CFrame + endPos
             end
    end
        v.Touched:Connect(function(hit)
    if hit.Parent.Name ~= nil then

        local yo = hit.Parent:findFirstChild("Humanoid")
        if yo == Character.Humanoid then
            yo.Health = yo.Health - 0
        else
            local tween = game:GetService("TweenService")
            local boom = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)
            local boomprop = {Anchored = true;CanCollide = false;Transparency = 1;Size = Vector3.new(48,48,48) }
            local ew = tween:Create(v,boom,boomprop)
            ew:Play()
            yo.Health = yo.Health - Player.Data.FireDamage.Value
            wait(1.5)
            Shower:Destroy()

    end
        end
    end)
    end
    end)



In the code above, I tried to make my fire move have an explosion effect whenever it touched something with collision turned on. I didn't make the fire shower itself uncollidable so that it wouldn't malfunction. The question is, whenever I launch the skill, the first 5-6 uses of this the fire shower explodes in the air without touching anything(Doesn't explode immediately after spawning it though). After those 5-6 moves, in the 7+ uses the fire shower bounces off a surface first and after 0.4 seconds or something it'll explode. Why does it behave like that?

0
Remote Events/Functions always have a delay due to the time it takes for data to be sent from the server to the client vice versa. GoldAngelInDisguise 297 — 6y
0
is there a way to fix this or am I just gonna have to deal with it? xXKingCool258Xx 39 — 6y
0
You can tween in the client as well. In fact, that is what you should be doing. On the client to give immediate feedback. It feels smoother that way. User#24403 69 — 6y
0
Also I encourage a better variable name rather than "Mouse". You're sending the Hit of the mouse, not the mouse itself. It's misleading. User#24403 69 — 6y
0
I'll rename the mouse, can you please tell me how do you tween in the client? xXKingCool258Xx 39 — 5y

Answer this question