So I made a script that will detect when it's a door it shows a little gui to interact, But my code isn't even running, Even prints on the top isn't working, Can anyone help me, Literally any code will not run at all, It might also be the fact it's in replicatedStorage, Can anyone help?

game:GetService("Players").PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		
		for _, v in pairs(workspace:GetDescendants()) do
			if v:FindFirstChild("Interactable") then

				local magnitude = (v.Position - char:FindFirstChild("HumanoidRootPart").Position).magnitude
				
				print(magnitude)

				if magnitude <= script.Parent:FindFirstChild("InteractGui"):FindFirstChild("InteractBoard").MaxDistance then

					print("In sight!")

					local newGui = script.Parent:FindFirstChild("InteractGui"):Clone()
					newGui.Parent = player:WaitForChild("PlayerGui")

					newGui:WaitForChild("InteractBoard").Adornee = v

				else
					if player:WaitForChild("PlayerGui"):FindFirstChild("InteractGui") then

						print("Got out of sight!")

						player:WaitForChild("PlayerGui"):FindFirstChild("InteractGui"):Destroy()

					else

						print("Never was in sight!")

					end
				end
			end
		end		
		
	end)
end)

4 comments

2

Nvm scripts don't run inside replicatedStorage

0

facepalm

0

lol

0

xDDDDD