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

With button script, I get error "Argument 1 missing or nil"?

Asked by
XRed03 17
1 year ago

I'm trying to make a button that closes a door on press. However, whenever I run my code, I get the error on line 9. This is my code thus far:

local switch = script.Parent
local switched = script.Parent:WaitForChild("Switched")
local TS = game:GetService("TweenService")
local LD = workspace.LeftDoor
local goal = {}
local TInfo = TweenInfo.new(1)

while true do
    switched:GetPropertyChangedSignal():Wait()
    if switched.Value then
        goal.Position = Vector3.new(-10.125, 2.5, -3.125)
        TS:Create(LD, goal, TweenInfo.new(0.3)):Play()
        goal.Position = Vector3.new(-14.125, 3.625, 7)
        TS:Create(LD, goal, TInfo):Play()
    end
end

P.S. My code isn't complete, I will finish it once I'm past this roadblock.

2 answers

Log in to vote
0
Answered by
Puppynniko 1059 Moderation Voter
1 year ago

you need a argument on :GetPropertyChangedSignal() to see what get changed add a string inside like this :GetPropertyChangedSignal("Value") or use .Changed

Ad
Log in to vote
0
Answered by
enes223 327 Moderation Voter
1 year ago

hey you! have you ever heard of enes? if you are in trouble, better call enes!

Answer this question