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

Tween isn't working and there is nothing in output. What's the error?

Asked by 3 years ago

So. I was trying to make this thing when you press the key, E on your keyboard. The door tweens. But it doesn't show anything in the output. Here is the code, this code is written in a regular script, not a local script, not a module script.

    local UIS = game:GetService("UserInputService")
    local MaxDistance = 5
    UIS.InputBegan:Connect(function(input, player)
        if input.KeyCode == Enum.KeyCode.E then
        local HumanoidRootPart = player.Character.HumanoidRootPart
        local MainPart = game.Workspace.MainPart
        local TweenService = game:GetService("TweenService")
        if HumanoidRootPart.Position - MainPart.Position.Magnitude <= MaxDistance then
            local TweenInformation = TweenInfo.new(
                3,
                Enum.EasingStyle.Sine,
                Enum.EasingDirection.Out,
                0,
                true,
                1
            )
            local Properties = {
                Size = Vector3.new(6.27, 0.05, 2);
            }
            local Tween = TweenService:Create(MainPart,TweenInformation,Properties)
            Tween:Play()
        end
        end
    end)
0
"if HumanoidRootPart.Position - MainPart.Position.Magnitude <= MaxDistance then" -> "if (HumanoidRootPart.Position - MainPart.Position).Magnitude <= MaxDistance then" 9mze 193 — 3y
0
Another error is your player. The 2nd argument of InputBegan:Connect is not player, is gameProcessed. 9mze 193 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

InputBegan is an event that fires only on the client, not the server, and the second argument of the InputBegan event is not the player.

Ad

Answer this question