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

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

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

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

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

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