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

How to increase head size without player falling over?

Asked by 4 years ago

I'm new to scripting with only a little bit of experience in python and this is my first time scripting in lua so I edited a deathblock script to increase headsize and this is what I got:

function onTouch(part) 
    local humanoid = part.Parent:FindFirstChild("Humanoid") 
    if (humanoid ~= nil) then
        humanoid.HeadScale.Value = humanoid.HeadScale.Value + 0.02
    end 
end

script.Parent.Touched:connect(onTouch)

The code itself works great but I have three other problems.

Once the head size gets to about 5, the player starts falling over and everything and I've tried to disable cancollide but that didn't do anything.

The code goes way too fast. I've tried adding wait variables to some of the parts in the code, but it seems to skip right past it. I did "wait(10)" in different spots, but of course it didn't seem to do anything.

The final thing is that I would like the item to be like a tool that you have in your inventory and when you click the script runs. Right now it's just a block that when you step on it the script runs

I'm pretty much a complete beginner in coding so if anyone can help me out thanks

1 answer

Log in to vote
1
Answered by 4 years ago

CanCollide only disables collisions, and not Mass, so Instead, I made It so the head has no mass

Here is the script

function onTouch(part)
        local humanoid = part.Parent:FindFirstChild("Humanoid")
        if (humanoid ~= nil) then
            local head = humanoid.Parent:FindFirstChild("Head")
            head.Massless = true
            humanoid.HeadScale.Value = humanoid.HeadScale.Value + 0.02
     end
end

script.Parent.Touched:connect(onTouch)
0
Thanks this worked great Frostmaniz 4 — 4y
0
Your welcome doomblade_66 55 — 4y
0
Also, if it worked, check mark my answer doomblade_66 55 — 4y
0
I would but I don't know how to be honest. All I see is a report button and an upvote button, but it says I need 25 reputation Frostmaniz 4 — 4y
View all comments (2 more)
0
you're good then, and if you need help with something else just tell me here. doomblade_66 55 — 4y
0
I did it for you. You have to hover over the answer and there should be a button to accept the answer. royaltoe 5144 — 4y
Ad

Answer this question