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

My script isn't working. Help?

Asked by 9 years ago

My local script, when a projectile is fired, meaning, there is no direct contact, it's supposed to print the Player, and Humanoid.

local Player = script.Parent.Parent
 local mouse = Player:GetMouse()
function onKeyDown(key)

    Key = key:lower()
    if key == "z" then
        print("Hi")

    Game:GetService("Chat"):Chat(Player.Character.Head, "I'll finish you off with this last hit!")



    x = Instance.new("Part")
    x.Name = "x"
    x.Shape = "Ball"
    x.BrickColor = BrickColor.new("Really red")
    x.Size = Vector3.new(3,3,3)
    x.CanCollide = false
            x.CFrame = Player.Character.Torso.CFrame*CFrame.new(0, 0, -12)

    s = Instance.new("Sparkles", x)
    y = Instance.new("BodyVelocity", x)
    y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
    y.velocity = Player.Character.Torso.CFrame.lookVector*120
    x.Parent = Workspace
    kk = script.k:Clone()
    kk.Parent = x
    x.Name = Player.Name
    game:GetService("Debris"):AddItem(x, 7)

    kk.Disabled = false
    end


end
mouse.KeyDown:connect(onKeyDown)

function tagHumanoid(humanoid, player)
    local creator_tag = Instance.new("ObjectValue")
    creator_tag.Value = player
    creator_tag.Name = "creator"
    creator_tag.Parent = humanoid
    print(player.Name)
    print(humanoid.Name)
end

function untagHumanoid(humanoid)
    if humanoid ~= nil then
        local tag = humanoid:findFirstChild("creator")
        if tag ~= nil then
            tag.Parent = nil
        end
    end
end

This is the 2ND time in which I ask a question similar to this. The first time, they completely ignored what I said.

0
There is not enough of the script given to properly help you. User#2263 0 — 9y
0
I'ght, lemme fix it. offbeatpizzalives123 105 — 9y
0
You're not calling the tag and untagHumanoid functions anywhere, so it won't print the player's name or humanoid's name. Spongocardo 1991 — 9y
0
It's still not working, even after I called both function. Keeps saying 'player' is a nil value. offbeatpizzalives123 105 — 9y
View all comments (4 more)
0
Then you're obviously not feeding in a player argument when you call it... Perci1 4988 — 9y
0
What do you mean by 'feeding in a player argument'? offbeatpizzalives123 105 — 9y
0
Well you have two parameters for you function; 'humanoid' and 'player'. When you call the function, if you don't give it two arguments for those parameters to equal, they will be nil. Perci1 4988 — 9y
0
The two functions that I need help with, what they do is find who bloxxed who. It's how Servers kept track of who KOs and WOs. Mind PMing me an example? offbeatpizzalives123 105 — 9y

Answer this question