Issues with a card activated door


#21

Oh yeah, there’s no space between Room and 000


#22

So… I’ve removed the space. Changed all the scripts effecting the space to remove it… AND STILL DOESN’T WORK?..


#23

If it would make you feel any better, I’ll give you this part that I made to test your code. It works perfectly fine for me, but it makes use of players touching the door instead of cards. Just use the code for a reference.

Door.rbxm (2.8 KB)


#24

Heres a file to the buggy door if you need it:

CardDoorIssue.rbxl (24.5 KB)


#25

Also - How in the actual world do I open .rbxm files? It just opens notepad?


#26

You have to drag them into an open studio place


#27

I think I found the problem :slight_smile: quite embarassed for not seeing this

local db = false
script.Parent.DoorMain.Touched:Connect(function(handle)
	print(handle.Parent.Name)
	if db == false then
		db = true
		if handle.Parent.Name == 'Room'.. script.Parent.Configuration.RoomNumber.Value then
			script.Parent.DoorMain.Transparency = 1
			script.Parent.DoorMain.CanCollide = false
			wait(1)
			script.Parent.DoorMain.Transparency = 0
			script.Parent.DoorMain.CanCollide = true
		else
			print("Wrong card")
		end
	db = false
	end
end)

Your card name is “Room201” but the code says “Card201”


#28

Nope, xD.


#29

Hmmmm it worked for me :confused:
CardDoorIssueFixed.rbxl (24.5 KB)


#30

Hm, let me check it out. :slight_smile:


#31

Alright, whenever I put the card in StarterPack, and I’m not inserting it… It just… works? But whenever I use the script… It wont?


#32

It’s because you’re parenting the card to ReplicatedStorage and not a player’s backpack?


#33

Yes, but whenever I do however, set the cards parent to the backpack of the player, it doesnt work…?


#34

What’s your script to give players a card?


#35
local RoomTool = game:GetService('ReplicatedStorage'):WaitForChild('WC_Assets'):WaitForChild('Room'):Clone()

RoomTool.Name = 'Room'..script.Parent:WaitForChild('Configuration'):WaitForChild('RoomNumber').Value
RoomTool.Parent = game:GetService('Players'):WaitForChild('wayIxn').Backpack

local db = false
script.Parent.DoorMain.Touched:Connect(function(handle)
	print(handle.Parent.Name)
	if db == false then
		db = true
		if handle.Parent.Name == 'Room'.. script.Parent.Configuration.RoomNumber.Value then
			script.Parent.DoorMain.Transparency = 1
			script.Parent.DoorMain.CanCollide = false
			wait(1)
			script.Parent.DoorMain.Transparency = 0
			script.Parent.DoorMain.CanCollide = true
		else
			print("Wrong card")
		end
	db = false
	end
end)

Line 2, it doesnt even parent.

Whenever I give it via command bar, it doesnt work…?

game.ReplicatedStorage.WC_Rooms['Room201'].Parent = game.Players.wayIxn.Backpack

#36

Whevener I do any ‘Alternative’ other than setting its default parent to StarterPack (which would never work for the game I’m working on) it simply doesnt open. Though when I change absolutely NOTHING it does.


#37

Nvm - Had to parent it on the server side. Thank you SO MUCH for your 1h+ of time to help me. You’re truly amazing and I can’t thank you enough. :))) :heart: