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

attempt to perform arithmetic (add) on Instance and Vector3?

Asked by 2 years ago

I have this script in a part and whenever you touch it you're supposed to have a blurry vision and some spinning ducks spawn on your head like in cartoons when they're dizzy. Now that I've cloned it I change it's parent to the hit.Parent.head which is the player's head and I wanted to make it higher but this error pops up. Can anyone help? Here is the script

local boulder = script.Parent

function onTouch(hit)
    local char = hit.Parent:FindFirstChild("Humanoid")
    if char then
        local vfx = game.ReplicatedStorage:WaitForChild("VFX")
        local dizzyDucks = vfx.Dizzy:Clone()
        local blur = game.Lighting.Blur
        char.JumpPower = 0
        char.WalkSpeed = 0
        dizzyDucks.Parent = hit.Parent.Head + Vector3.new(0,1,0)
        blur.Size = 54

        wait(3)
        char.JumpPower = 50
        char.WalkSpeed = 16
        dizzyDucks:Destroy()
        blur.Size = 0
    end
end

boulder.Touched:Connect(onTouch)

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

hit.Parent.Head is a Instance, and you want to add it with Vector3.

I think you meant:

dizzyDucks.Parent = hit.Parent.Head
-- or
dizzyDucks.Parent = hit.Parent.Head
dizzyDucks.Position = dizzyDucks.Position + Vector3.new(0,1,0)
Ad

Answer this question