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

The CFrame rotation is not working right?

Asked by 3 years ago

Working on a door with tweening service and it needs to rotate. Everytime I run the script below it says "Unable to cast to dictionary" from line 17. I know why it is saying this I just need to know how to state a CFrame rotation correctly.

--Script Here-- local Detector = game.Workspace.DoorDetector local buttonPressed = false --Store whether the button is pressed in a local variable local part = script.Parent local TweenService = game:GetService("TweenService") local tweeningInformation = TweenInfo.new( 1, -- how long the tween will take Enum.EasingStyle.Bounce, -- How the tween will play Enum.EasingDirection.Out, -- which way itll go 0, -- how many times itll repeat false, -- if you want it to repeat 1 -- delay time ) local DoorOpen = {CFrame = CFrame.new(117.53, 36.4, -269.812)} local DoorClose = {CFrame = CFrame.new(116.03, 36.4, -273.141), CFrame.Angles(0,math.rad(90),0)} local tween1open = TweenService:Create(part,tweeningInformation,DoorOpen) local tween1close = TweenService:Create(part,tweeningInformation,DoorClose) Detector.Touched:Connect(function(hit) if not buttonPressed then --Is button not pressed? buttonPressed = true tween1open:Play() local Brick = game.Workspace.AnimalTransporter -- 1 local AnotherBrick = game.Workspace.AnimalShop -- 2

    Brick.Touched:connect(function(part) -- 3
        if part.Parent.Humanoid then -- *
            if part.Parent.Humanoid.Health > 0 then -- 4
                part.Parent:MoveTo(AnotherBrick.Position) -- 5
                wait(1)
                tween1close:Play()
            end
        end
    end)
end

end)

0
you might need to fix your question because your code is unreadable. ScuffedAI 435 — 3y

Answer this question