Script failing to set the value of a variable

I see errors for Sound but I believe those aren’t related.

  10:49:28.046  Failed to load sound http://www.roblox.com/asset/?id=: Unable to download sound data (x24)  -  Studio

Yeah, that wouldn’t cause any issues.

I found the problem and I feel very dumb. Turns out I had a different script for a different ProximityPrompt in the game, and it was setting the variable to false. I’m so sorry for not noticing.

You were very helpful, thank you so much! :slight_smile:

local Service = game:GetService("ProximityPromptService")
local Prompt = script.Parent
local mdl = script.Parent.Parent.Parent.Parent
local door = mdl.Door
local Close = mdl.Var.Closed
local posX = script.Parent.Parent.Parent.Parent.Door.Position.X
local posY = script.Parent.Parent.Parent.Parent.Door.Position.Y
local posZ = script.Parent.Parent.Parent.Parent.Door.Position.Z

local function Open(prompt, player)
	Close.Value = false
	door.Position = Vector3.new(posX, posY, posZ)
end

local function Close(prompt, player)
	Close.Value = true
	door.Position = Vector3.new(posX, posY, posZ)
end

Service.PromptTriggered:Connect(Open)
Service.PromptTriggeredEnded:Connect(Close)

All good, I just got to making this slight modification too.

1 Like