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

Why doesnt my script work?:Tryingtocallmethodonobjectoftype:`Vector3`withincorrectarguments

So i am making an myth game and i need to use this script:

function onTouched(part)
if part.Parent ~= nil then
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil then			
h.Parent.HumanoidRootPart.Velocity=Vector3.new(x,y,z)
Sound:Play()
script.Parent.Parent.HalfSphere.Size = Vector3.new()(2.9, 0.7, 2.9)
wait(0.5)
script.Parent.Parent.HalfSphere.Size = Vector3.new()(3.9, 1.7, 3.9)				
end
end
end

When i click "play" it says Trying to call method on object of type: Vector3 with incorrect arguments. (in line 12) Can you help with this?

1 answer

✓ Accepted answer

You have some errors on line 7 and line 9. You should insert the values from the second brackets and put them in the first brackets.

function onTouched(part)
if part.Parent ~= nil then
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil then          
h.Parent.HumanoidRootPart.Velocity=Vector3.new(x,y,z)
Sound:Play()
script.Parent.Parent.HalfSphere.Size = Vector3.new(2.9, 0.7, 2.9)
wait(0.5)
script.Parent.Parent.HalfSphere.Size = Vector3.new(3.9, 1.7, 3.9)             
end
end
end

5 comments

0

Thanks!

0

accept my answer if it worked!

0

But.... No it didnt. There's no error in the dev console, and the script dont changes size AND it dont launchs me up AND it isnt disabled. Got any solutions?

0

have a longer wait time if it gets sized too quickly. i can't help you with anything else, since you only wanted help for this.

0

k

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