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

Why Will My Soccer/Football Goalkeeper Not Move?

Asked by
jacobwow 140
9 years ago

Everything in the script works fine, the model Stance goes to the lighting and you can see the Save1 model in the workspace, but it is not behind the ball, it is in the same position it was in the lighting. How do I move the keeper behind the ball 3 studs? Script:

local Detector = script.Parent
local gameBall = game.Workspace.gameBall
local Save1 = game.Lighting.Save1
local Ready = true
local Stance = game.Workspace.Stance

function onTouch(Part)
        if Ready == true then
            Ready = false
            Stance.Parent = game.Lighting
            Save1.Parent = game.Workspace
            Save1.Child.CFrame = CFrame.new(gameBall.Position+Vector3.new(3,0,0))
            wait(2)
            Ready = true
            Stance.Parent = game.Workspace
            Save1.Parent = game.Lighting             
    end
end

Detector.Touched:connect(onTouch)

2 answers

Log in to vote
1
Answered by 9 years ago

Just use Position for Line 12 instead of CFrame, it would be much easier than making it a CFrame.

local Detector = script.Parent
local gameBall = game.Workspace.gameBall
local Save1 = game.Lighting.Save1
local Ready = true
local Stance = game.Workspace.Stance

function onTouch(Part)
        if Ready == true then
            Ready = false
            Stance.Parent = game.Lighting
            Save1.Parent = game.Workspace
            Save1.Child.Position = gameBall.Position + Vector3.new(3,0,0) --Puts the keeper 3 studs behind where the ball is.
            wait(2)
            Ready = true
            Stance.Parent = game.Workspace
            Save1.Parent = game.Lighting             
    end
end

Detector.Touched:connect(onTouch)
Ad
Log in to vote
0
Answered by 9 years ago

Make sure the model is NOT anchored. This happens to me a lot and need to make sure you don't have the same issue!

Answer this question