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

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

Asked by
Choobu 59
5 years ago

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

0
Don't use KeyDown. Use UserInputService instead User#19524 175 — 5y
0
Yeah, Incapaz true Diltz_3 75 — 5y
0
k Choobu 59 — 5y
0
on line 22 you put 2 cframes seith14 206 — 5y

1 answer

Log in to vote
0
Answered by
seith14 206 Moderation Voter
5 years ago
Edited 5 years ago
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)

0
This should work. seith14 206 — 5y
0
And it goes in starterpack or startergui? Choobu 59 — 5y
0
Whatever I'm doing its not working. It won't even say the chating part.. Choobu 59 — 5y
0
What error codes are you getting? seith14 206 — 5y
View all comments (2 more)
0
wait do you have anything to run the function? seith14 206 — 5y
0
Try it again I just changed a part of it seith14 206 — 5y
Ad

Answer this question