New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

My Ko script is not functioning correctly?

Asked by 11 days ago
Edited 11 days ago

Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.

note:this is not the full script; the problem is every thing works except for when the humanoid's health is zero is doesn't create the string value which shows which player killed the humanoid, neither does the "You Killed"gui

function e(plr,hit,Target,Dmg,raycf)
    spawn(function()
    local ray=Ray.new(raycf.p,(hit.p-raycf.p).unit*300)
    local Hit,Pos=workspace:FindPartOnRay(ray,Ignore)
    if Hit.Parent:FindFirstChildWhichIsA("Humanoid")~=nil then
        if game.Players:GetPlayerFromCharacter(Hit.Parent)~=nil then
        if game.Players:GetPlayerFromCharacter(Hit.Parent).TeamData.Team.Value~=plr.TeamData.Team.Value then
        Hit.Parent:FindFirstChildWhichIsA("Humanoid"):TakeDamage(Dmg)
        if Hit.Parent:FindFirstChildWhichIsA("Humanoid").Health==0 then
            spawn(function()
            local clone = script.kill:Clone()
            clone.Parent=plr.PlayerGui
            clone.TextLabel.Text="[!+100! you killed]"..Hit.Parent.Name
            local killer=Instance.new("StringValue",Hit.Parent:FindFirstChildWhichIsA("Humanoid"))
            killer.Name="Killer"
            killer.Value=plr.Name
            wait(3)
            clone:Destroy()
            end)
        end
        end
        end
    end
    local raypart=Instance.new("Part",workspace)
    raypart.Anchored=true
    raypart.Material="Neon"
    raypart.Color=Color3.fromRGB(255,0,0)
    raypart.CanCollide=false
    raypart.Name=plr.Name
    local Dist=(Pos-raycf.p).magnitude
    raypart.Size=Vector3.new(0.1,0.1,Dist)
    raypart.CFrame=CFrame.new(raycf.p,Pos)*CFrame.new(0,0,-Dist/2)
    game.Debris:AddItem(raypart,0.1)
    end)
end

game.ReplicatedStorage.Remotes.Shoot.OnServerEvent:Connect(e)
0
It's great that you posted some of the code but can you tell us where the problem is? GGRBXLuaGG 332 — 11d
0
sorry i was in a bit of a rush when i posted this :), i added more details now iop2319 0 — 11d

Answer this question