Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My block wont spawn on ontop of my UpperTorso What should I do?

I'm trying to make a script where a block spawns exactly on a player upper-torso but high in the skies then later on the block size with increase in the y-axis until it touches back down the ground.

local enabled = true
Player = script.Parent.Parent
me = Player
mouse = Player:GetMouse()
function onKeyDown(key)
if not enabled then return end
enabled = false
key = key:lower()

    if key == "t" then

        local Run = game:GetService("RunService")
    local clone = script.Rotate:Clone()
    clone.Parent = Player.PlayerGui
    clone.Disabled = false
    game:GetService("Chat"):Chat(Player.Character.Head, "Run Away kids, Please. . .")
        for i = 1, 1 do
            wait(3)
            clone:remove()
        local g = script.Beam:Clone()
        g.Parent = game.Workspace
        g.CFrame = Player.Character.UpperTorso.CFrameCFrame.new(0, 60, 0)
        g.Orientation = Vector3.new (0, 0, -90)
        local y = Instance.new("BodyVelocity")
        script.Damage:Clone().Parent = g
        wait(2)
        for i = 1,20 do
        g.Size = g.Size + (0, -0.01, 0)
        wait(2)
        end
        g:remove()
        wait()
        for i = 1, 12 do
        end

                Run.Stepped:wait(0.0001)
            Run.Stepped:wait(0.0001)
           end
wait(0.5)
    end



enabled = true
end

4 comments

0

Don't use KeyDown. Use UserInputService instead

0

Yeah, Incapaz true

0

k

0

on line 22 you put 2 cframes

1 answer

local input = game:GetService("UserInputService")

function UserInput(key)
if not enabled then return end
enabled = false
key = key:lower()

    if key.KeyCode == Enum.KeyCode.T then

        local Run = game:GetService("RunService")
    local clone = script.Rotate:Clone()
    clone.Parent = Player.PlayerGui
    clone.Disabled = false
    game:GetService("Chat"):Chat(Player.Character.Head, "Run Away kids, Please. . .")
        for i = 1, 1 do
            wait(3)
            clone:remove()
        local g = script.Beam:Clone()
        g.Parent = game.Workspace
        g.CFrame = CFrame.new(Player.Character.UpperTorso.Position + Vector3.new.new(0, 60, 0)) -- I added the position and a Vector3 Value and Found it's CFrame
        g.Orientation = Vector3.new (0, 0, -90)
        local y = Instance.new("BodyVelocity")
        script.Damage:Clone().Parent = g
        wait(2)
        for i = 1,20 do
        g.Size = g.Size + (0, -0.01, 0)
        wait(2)
        end
        g:remove()
        wait()
        for i = 1, 12 do
        end

                Run.Stepped:wait(0.0001)
            Run.Stepped:wait(0.0001)
           end
wait(0.5)
    end



enabled = true
end

input.InputBegan:connect(UserInput)

6 comments

0

This should work.

0

And it goes in starterpack or startergui?

0

Whatever I'm doing its not working. It won't even say the chating part..

0

What error codes are you getting?

0

wait do you have anything to run the function?

0

Try it again I just changed a part of it

This discussion is preserved as it was. New answers, comments, and votes are closed.