#Scripting Help - im trying to spawn 3 models over my head and make them go where the player clicked

60 messages · Page 1 of 1 (latest)

vast cargo
#

P.S: its in a local script in starter pack

local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character
if not character or not character.Parent then
    character = player.CharacterAdded:Wait()
end

local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")

local spiritBomb = game.ReplicatedStorage:FindFirstChild('SpiritBomb')
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local runService = game:GetService('RunService')
mouse.KeyDown:Connect(function(key)
    if key == 'v' then

        local head = player.Character.Head
        local spiritBombClone1 = spiritBomb:Clone()
        spiritBombClone1.Parent = workspace
        spiritBombClone1:SetPrimaryPartCFrame(head.CFrame * CFrame.new(0, 15, 0))
        
        local head = player.Character.Head
        local spiritBombClone2 = spiritBomb:Clone()
        spiritBombClone2.Parent = workspace
        spiritBombClone2:SetPrimaryPartCFrame(head.CFrame * CFrame.new(10, 15, 0))
        
        local head = player.Character.Head
        local spiritBombClone3 = spiritBomb:Clone()
        spiritBombClone3.Parent = workspace
        spiritBombClone3:SetPrimaryPartCFrame(head.CFrame * CFrame.new(0, 15, 10))
        
        wait(1)
        
        local cf = spiritBombClone1:GetPrimaryPartCFrame()
        local cf = spiritBombClone2:GetPrimaryPartCFrame()
        local cf = spiritBombClone3:GetPrimaryPartCFrame()
        local hit = mouse.hit
        
        wait(0.5)
        
        for i = 1, 30 do
            spiritBombClone1:SetPrimaryPartCFrame(cf:Lerp(hit, i/30))
            runService.RenderStepped:Wait()
            spiritBombClone2:SetPrimaryPartCFrame(cf:Lerp(hit, i/30))
            runService.RenderStepped:Wait()
            spiritBombClone3:SetPrimaryPartCFrame(cf:Lerp(hit, i/30))
            runService.RenderStepped:Wait()
        end
```​
fast mist
#

@dim birch

#

send the sticker

#

sir

vast cargo
#
local inner1 = spiritBombClone1.inner
        local outter1 = spiritBombClone1.outter
        local originalSizeInner = inner1.Size
        local originalSizeOutter = outter1.Size
        local scaleFactor = 10
        
        local inner2 = spiritBombClone2.inner
        local outter2 = spiritBombClone2.outter
        local originalSizeInner = inner2.Size
        local originalSizeOutter = outter2.Size
        local scaleFactor = 10
        
        local inner3 = spiritBombClone3.inner
        local outter3 = spiritBombClone3.outter
        local originalSizeInner = inner3.Size
        local originalSizeOutter = outter3.Size
        local scaleFactor = 10
#
for i = 1, 100 do
            inner1.Size = originalSizeInner:Lerp(originalSizeInner * scaleFactor, i/100)
            outter1.Size = originalSizeOutter:Lerp(originalSizeOutter * scaleFactor, i/100)
            inner1.Transparency = i/100
            outter1.Transparency = .5 + i/100
            runService.RenderStepped:Wait()
            
            inner2.Size = originalSizeInner:Lerp(originalSizeInner * scaleFactor, i/100)
            outter2.Size = originalSizeOutter:Lerp(originalSizeOutter * scaleFactor, i/100)
            inner2.Transparency = i/100
            outter2.Transparency = .5 + i/100
            runService.RenderStepped:Wait()
            
            inner3.Size = originalSizeInner:Lerp(originalSizeInner * scaleFactor, i/100)
            outter3.Size = originalSizeOutter:Lerp(originalSizeOutter * scaleFactor, i/100)
            inner3.Transparency = i/100
            outter3.Transparency = .5 + i/100
            runService.RenderStepped:Wait()
            
        end
    end
end)
fast mist
#

bro

vast cargo
#

yeah bu ti had to seperate it

#

in different parts

dim birch
vast cargo
#

i changed it

fast mist
#

u forgot

#

lua markdown

vast cargo
#

ok

fast mist
# dim birch

need a gif with monkeys saying, "where problem"

vast cargo
#

i need help 😭

dim birch
dim birch
vast cargo
#

its ok

#

but is there a problem with the script?

fast mist
#

U need to tell that

dim birch
#

Please, for the love of God, use loops

#

Literally same shit in multiple lines...

fast mist
#

Xd

vast cargo
#

I know

shy vigilBOT
#

studio** You are now Level 3! **studio

vast cargo
#

its bc im trying to make three different balls that go in the same direction

#

but dont combine together

#

and go each at a time

dim birch
#

You can make infinite different things using a simple for loop

vast cargo
#

local spiritBomb = game.ReplicatedStorage:FindFirstChild('SpiritBomb')
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local runService = game:GetService('RunService')
mouse.KeyDown:Connect(function(key)
    if key == 'v' then
        for count = 0, 3, 1 do
            local head = player.Character.Head
            local spiritBombClone = spiritBomb:Clone()
            spiritBombClone.Parent = workspace
            spiritBombClone:SetPrimaryPartCFrame(head.CFrame * CFrame.new(0, 15, 0))

            wait(1)

            local cf = spiritBombClone:GetPrimaryPartCFrame()
            local hit = mouse.hit

            wait(0.5)

            for i = 1, 30 do
                spiritBombClone:SetPrimaryPartCFrame(cf:Lerp(hit, i/30))
                runService.RenderStepped:Wait()
            end 

            local inner = spiritBombClone.inner
            local outter = spiritBombClone.outter
            local originalSizeInner = inner.Size
            local originalSizeOutter = outter.Size
            local scaleFactor = 10



            for i = 1, 100 do
                inner.Size = originalSizeInner:Lerp(originalSizeInner * scaleFactor, i/100)
                outter.Size = originalSizeOutter:Lerp(originalSizeOutter * scaleFactor, i/100)
                inner.Transparency = i/100
                outter.Transparency = .5 + i/100
                runService.RenderStepped:Wait()

            end
        end
    end
end)
#

what about now?

#

i put the whole things into a loop

dim birch
#

Hope is gud hehe

#

Ok I feel bad for what I did, here, take this

#

I used parts of your scripts btw

#

And something tells me is missing

#

oh yea... The loop...

#

Hold up, Imma fix it

fast mist
#

XD

#

U shoulve kept the first image

dim birch
#

I feel bad for him...

#
  • is not the best script Ive made... I dont really understand whats going on
vast cargo
#

same

dim birch
#

Why he is chaning the CFrames multiple times... and why he is not just using TweenService

dim birch
vast cargo
#

the problem is that i made a loop

#

but when i activate the loop

#

it does it three times automatically

#

but not three balls

#

one at a time

dim birch
#

This should work, maybe not as you wish, but close

vast cargo
#

There’s an error

#

@dim birch doesnt work

remote hinge
#

Tell me

#

What is the error